ImageKnife3.x分支合并master
Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
parent
d7e6864a82
commit
55cc9f7a78
|
@ -7,9 +7,9 @@
|
||||||
{
|
{
|
||||||
"name": "default",
|
"name": "default",
|
||||||
"signingConfig": "default",
|
"signingConfig": "default",
|
||||||
"compileSdkVersion": "5.0.0(12)",
|
"compileSdkVersion": 12,
|
||||||
"compatibleSdkVersion": "5.0.0(12)",
|
"compatibleSdkVersion": 12,
|
||||||
"runtimeOS": "HarmonyOS",
|
"runtimeOS": "OpenHarmony",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"buildModeSet": [
|
"buildModeSet": [
|
||||||
|
|
|
@ -1,64 +1,69 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
|
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||||
import { ImageKnifeOption } from '@ohos/imageknife'
|
import { ImageKnifeOption,ImageKnifeData } from "@ohos/imageknife"
|
||||||
|
|
||||||
export default function ImageKnifeOptionTest() {
|
export default function ImageKnifeOptionTest() {
|
||||||
describe('ImageKnifeOptionTest', ()=> {
|
describe('ImageKnifeOptionTest',() => {
|
||||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||||
beforeAll( ()=> {
|
beforeAll(() => {
|
||||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
// 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.
|
// This API supports only one parameter: preset action function.
|
||||||
})
|
});
|
||||||
beforeEach( ()=> {
|
beforeEach(() => {
|
||||||
// Presets an action, which is performed before each unit test case starts.
|
// 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**.
|
// 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.
|
// This API supports only one parameter: preset action function.
|
||||||
})
|
});
|
||||||
afterEach( ()=> {
|
afterEach(() => {
|
||||||
// Presets a clear action, which is performed after each unit test case ends.
|
// 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**.
|
// 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.
|
// This API supports only one parameter: clear action function.
|
||||||
})
|
});
|
||||||
afterAll( ()=> {
|
afterAll(() => {
|
||||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
// 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.
|
// This API supports only one parameter: clear action function.
|
||||||
})
|
});
|
||||||
|
it('onLoadListener', 0, () => {
|
||||||
it('onLoadListener',0, ()=> {
|
|
||||||
let a = 'abc';
|
let a = 'abc';
|
||||||
let b: string = '';
|
let b: string = '';
|
||||||
let imageKnifeOption: ImageKnifeOption = {
|
let imageData:ImageKnifeData = {
|
||||||
loadSrc: 'https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658',
|
source: "",
|
||||||
|
imageWidth: 0,
|
||||||
|
imageHeight: 0,
|
||||||
|
}
|
||||||
|
let ImageKnifeOption: ImageKnifeOption = {
|
||||||
|
loadSrc: $r("app.media.rabbit"),
|
||||||
onLoadListener: {
|
onLoadListener: {
|
||||||
onLoadSuccess: (data) => {
|
onLoadFailed: (err) => {
|
||||||
if (typeof data == 'string') {
|
console.error("Load Failed Reason: " + err);
|
||||||
b = data;
|
},
|
||||||
|
onLoadSuccess: (data,imageknifeData) => {
|
||||||
|
if(typeof data == 'string') {
|
||||||
|
return b = data;
|
||||||
}
|
}
|
||||||
|
imageData = imageknifeData
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
onLoadFailed: (err) => {
|
},
|
||||||
console.log('Load Failed Reason: '+err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(imageKnifeOption.onLoadListener && imageKnifeOption.onLoadListener.onLoadSuccess && imageKnifeOption.onLoadListener.onLoadFailed) {
|
if (ImageKnifeOption.onLoadListener && ImageKnifeOption.onLoadListener.onLoadSuccess && ImageKnifeOption.onLoadListener.onLoadFailed) {
|
||||||
imageKnifeOption.onLoadListener.onLoadSuccess(a);
|
ImageKnifeOption.onLoadListener.onLoadSuccess(a,imageData);
|
||||||
imageKnifeOption.onLoadListener.onLoadFailed(a);
|
ImageKnifeOption.onLoadListener.onLoadFailed(a);
|
||||||
}
|
}
|
||||||
expect(a).assertEqual(b);
|
expect(a).assertEqual(b);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
{
|
{
|
||||||
"modelVersion": "5.0.0",
|
"hvigorVersion": "4.3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ohos/hvigor-ohos-plugin": "4.3.0"
|
||||||
},
|
},
|
||||||
"execution": {
|
"execution": {
|
||||||
// "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
|
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
|
||||||
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
|
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
|
||||||
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
|
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
|
||||||
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
|
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
|
||||||
|
@ -18,4 +19,4 @@
|
||||||
"nodeOptions": {
|
"nodeOptions": {
|
||||||
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
|
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue