commit
97a5ca1ec2
|
@ -19,6 +19,7 @@ import Transfrom from './transfrom.test'
|
|||
import RequestOptionTest from './requestoption.test'
|
||||
import ImageKnifeTest from './imageknife.test'
|
||||
import DiskLruCacheTest from './diskLruCache.test'
|
||||
import SendableDataTest from './SendableData.test'
|
||||
import DefaultJobQueueTest from './DefaultJobQueueTest.test';
|
||||
|
||||
export default function testsuite() {
|
||||
|
@ -29,5 +30,6 @@ export default function testsuite() {
|
|||
Transfrom()
|
||||
RequestOptionTest()
|
||||
ImageKnifeTest();
|
||||
SendableDataTest();
|
||||
DefaultJobQueueTest();
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
|
||||
import { SendableData } from '@ohos/imageknife/src/main/ets/components/imageknife/SendableData'
|
||||
|
||||
export default function SendableDataTest() {
|
||||
describe('SendableDataTest', ()=> {
|
||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||
beforeAll( ()=> {
|
||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
beforeEach( ()=> {
|
||||
// Presets an action, which is performed before each unit test case starts.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
afterEach( ()=> {
|
||||
// Presets a clear action, which is performed after each unit test case ends.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
afterAll( ()=> {
|
||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
it('TestPlaceHolderCacheKey', 0, () => {
|
||||
let value: string = "placeholderRegisterCacheKey";
|
||||
let data: SendableData = new SendableData();
|
||||
data.setPlaceHolderRegisterCacheKey(value);
|
||||
expect(data.getPlaceHolderRegisterCacheKey()).assertEqual(value);
|
||||
})
|
||||
it('TestPlaceHolderMemoryCacheKey', 1, () => {
|
||||
let value: string = "placeholderRegisterMemoryCacheKey";
|
||||
let data: SendableData = new SendableData();
|
||||
data.setPlaceHolderRegisterMemoryCacheKey(value);
|
||||
expect(data.getPlaceHolderRegisterMemoryCacheKey()).assertEqual(value);
|
||||
})
|
||||
})
|
||||
}
|
|
@ -91,6 +91,18 @@ export default function RequestOptionTest() {
|
|||
expect(option.loadThumbnailReady).assertFalse()
|
||||
|
||||
})
|
||||
it('TestPlaceHolder', 4, () => {
|
||||
let url: string = "https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658";
|
||||
let option = new RequestOption();
|
||||
option.placeholder(url);
|
||||
expect(option.placeholderSrc).assertEqual(url);
|
||||
})
|
||||
it('TestFallBack', 5, () => {
|
||||
let url: PixelMap | Resource = $r('app.media.icon_loading');
|
||||
let option = new RequestOption();
|
||||
option.fallback(url);
|
||||
expect(JSON.stringify(option.fallbackSrc)).assertEqual(JSON.stringify(url));
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue