未验证 提交 4afaac66 编写于 作者: O openharmony_ci 提交者: Gitee

!4879 无障碍gesture测试用例目录改造以及编译错误修正

Merge pull request !4879 from Mupceet/release_0804_xts_compile
...@@ -17,7 +17,9 @@ group("barrierfree") { ...@@ -17,7 +17,9 @@ group("barrierfree") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"accessibilityconfig:ActsAccessibilityConfigTest",
"accessibilityelement:ActsAccessibilityElementTest", "accessibilityelement:ActsAccessibilityElementTest",
"accessibilityevent:ActsAccessibilityEventTest",
"accessibilityextension:ActsAccessibilityExtensionTest", "accessibilityextension:ActsAccessibilityExtensionTest",
"accessibilityextensioncontext:ActsAccessibilityExtensionContextTest", "accessibilityextensioncontext:ActsAccessibilityExtensionContextTest",
"accessibilitygestureevent:ActsAccessibilityGestureEventTest", "accessibilitygestureevent:ActsAccessibilityGestureEventTest",
......
...@@ -568,330 +568,6 @@ export default function abilityTest() { ...@@ -568,330 +568,6 @@ export default function abilityTest() {
done(); done();
}) })
/*
* @tc.number AccessibilityConfigTest_set_asyncCallback_3100
* @tc.name AccessibilityConfigTest_set_asyncCallback_3100
* @tc.desc Test screenMagnifier.set() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncCallback_3100', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_3100');
config.screenMagnifier.set(true, (err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_3100 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect(result).assertEqual(undefined);
done();
});
})
/*
* @tc.number AccessibilityConfigTest_set_asyncPromise_3200
* @tc.name AccessibilityConfigTest_set_asyncPromise_3200
* @tc.desc Test screenMagnifier.set() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncPromise_3200', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_3200');
config.screenMagnifier.set(false).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_3200 result: ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_set_asyncPromise_3200 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncCallback_3300
* @tc.name AccessibilityConfigTest_get_asyncCallback_3300
* @tc.desc Test screenMagnifier.get() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncCallback_3300', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_3300');
config.screenMagnifier.get((err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_3300 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect('boolean').assertEqual(typeof (result));
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncPromise_3400
* @tc.name AccessibilityConfigTest_get_asyncPromise_3400
* @tc.desc Test screenMagnifier.get() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncPromise_3400', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncPromise_3400');
config.screenMagnifier.get().then((result) => {
console.info(`AccessibilityConfigTest_get_asyncPromise_3400 result: ${result}`);
expect('boolean').assertEqual(typeof (result));
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_get_asyncPromise_3400 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_on_asyncCallback_3500
* @tc.name AccessibilityConfigTest_on_asyncCallback_3500
* @tc.desc Test screenMagnifier.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_on_asyncCallback_3500', 0, async function(done) {
console.info('AccessibilityConfigTest_on_asyncCallback_3500');
let ret = config.screenMagnifier.on((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number AccessibilityConfigTest_off_asyncCallback_3600
* @tc.name AccessibilityConfigTest_off_asyncCallback_3600
* @tc.desc Test screenMagnifier.off() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_off_asyncCallback_3600', 0, async function(done) {
console.info('AccessibilityConfigTest_off_asyncCallback_3600');
let ret = config.screenMagnifier.off((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number AccessibilityConfigTest_set_asyncCallback_3700
* @tc.name AccessibilityConfigTest_set_asyncCallback_3700
* @tc.desc Test audioMono.set() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncCallback_3700', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_3700');
config.audioMono.set(true, (err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_3700 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect(result).assertEqual(undefined);
done();
});
})
/*
* @tc.number AccessibilityConfigTest_set_asyncPromise_3800
* @tc.name AccessibilityConfigTest_set_asyncPromise_3800
* @tc.desc Test audioMono.set() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncPromise_3800', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_3800');
config.audioMono.set(false).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_3800 result: ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_set_asyncPromise_3800 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncCallback_3900
* @tc.name AccessibilityConfigTest_get_asyncCallback_3900
* @tc.desc Test audioMono.get() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncCallback_3900', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_3900');
config.audioMono.get((err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_3900 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect('boolean').assertEqual(typeof (result));
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncPromise_4000
* @tc.name AccessibilityConfigTest_get_asyncPromise_4000
* @tc.desc Test audioMono.get() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncPromise_4000', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncPromise_4000');
config.audioMono.get().then((result) => {
console.info(`AccessibilityConfigTest_get_asyncPromise_4000 result: ${result}`);
expect('boolean').assertEqual(typeof (result));
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_get_asyncPromise_4000 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_on_asyncCallback_4100
* @tc.name AccessibilityConfigTest_on_asyncCallback_4100
* @tc.desc Test audioMono.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_on_asyncCallback_4100', 0, async function(done) {
console.info('AccessibilityConfigTest_on_asyncCallback_4100');
let ret = config.audioMono.on((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number AccessibilityConfigTest_off_asyncCallback_4200
* @tc.name AccessibilityConfigTest_off_asyncCallback_4200
* @tc.desc Test audioMono.off() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_off_asyncCallback_4200', 0, async function(done) {
console.info('AccessibilityConfigTest_off_asyncCallback_4200');
let ret = config.audioMono.off((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number AccessibilityConfigTest_set_asyncCallback_4300
* @tc.name AccessibilityConfigTest_set_asyncCallback_4300
* @tc.desc Test audioBalance.set() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncCallback_4300', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_4300');
config.audioBalance.set(0, (err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_4300 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect(result).assertEqual(undefined);
done();
});
})
/*
* @tc.number AccessibilityConfigTest_set_asyncPromise_4400
* @tc.name AccessibilityConfigTest_set_asyncPromise_4400
* @tc.desc Test audioBalance.set() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_set_asyncPromise_4400', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_4400');
config.audioBalance.set(-1).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_4400 result: ${result}`);
expect(result).assertEqual(undefined);
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_set_asyncPromise_4400 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncCallback_4500
* @tc.name AccessibilityConfigTest_get_asyncCallback_4500
* @tc.desc Test audioBalance.get() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncCallback_4500', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncCallback_4500');
config.audioBalance.get((err, result) => {
if (err.code != 0) {
console.error(`AccessibilityConfigTest_get_asyncCallback_4500 has error: ${err.code}`);
expect(null).assertFail();
done();
}
expect('number').assertEqual(typeof (result));
done();
});
})
/*
* @tc.number AccessibilityConfigTest_get_asyncPromise_4600
* @tc.name AccessibilityConfigTest_get_asyncPromise_4600
* @tc.desc Test audioBalance.get() function in promise mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_get_asyncPromise_4600', 0, async function(done) {
console.info('AccessibilityConfigTest_get_asyncPromise_4600');
config.audioBalance.get().then((result) => {
console.info(`AccessibilityConfigTest_get_asyncPromise_4600 result: ${result}`);
expect('number').assertEqual(typeof (result));
done();
}).catch((err) => {
console.error(`AccessibilityConfigTest_get_asyncPromise_4600 has error: ${err.code}`);
expect(null).assertFail();
done();
});
})
/*
* @tc.number AccessibilityConfigTest_on_asyncCallback_4700
* @tc.name AccessibilityConfigTest_on_asyncCallback_4700
* @tc.desc Test audioBalance.on() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_on_asyncCallback_4700', 0, async function(done) {
console.info('AccessibilityConfigTest_on_asyncCallback_4700');
let ret = config.audioBalance.on((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/*
* @tc.number AccessibilityConfigTest_off_asyncCallback_4800
* @tc.name AccessibilityConfigTest_off_asyncCallback_4800
* @tc.desc Test audioBalance.off() function in callback mode.
* @tc.size SmallTest
* @tc.type User
*/
it('AccessibilityConfigTest_off_asyncCallback_4800', 0, async function(done) {
console.info('AccessibilityConfigTest_off_asyncCallback_4800');
let ret = config.audioBalance.off((data) => {});
expect(ret).assertEqual(undefined);
done();
})
/* /*
* @tc.number AccessibilityConfigTest_set_asyncCallback_4900 * @tc.number AccessibilityConfigTest_set_asyncCallback_4900
* @tc.name AccessibilityConfigTest_set_asyncCallback_4900 * @tc.name AccessibilityConfigTest_set_asyncCallback_4900
...@@ -1443,8 +1119,7 @@ export default function abilityTest() { ...@@ -1443,8 +1119,7 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncCallback_7900', 0, async function(done) { it('AccessibilityConfigTest_set_asyncCallback_7900', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_7900'); console.info('AccessibilityConfigTest_set_asyncCallback_7900');
let value = 'Normal'; config.daltonizationColorFilter.set('Normal', (err, result) => {
config.daltonizationColorFilter.set(value, (err, result) => {
if (err.code != 0) { if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_7900 has error: ${err.code}`); console.error(`AccessibilityConfigTest_set_asyncCallback_7900 has error: ${err.code}`);
expect(null).assertFail(); expect(null).assertFail();
...@@ -1464,8 +1139,7 @@ export default function abilityTest() { ...@@ -1464,8 +1139,7 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncCallback_8000', 0, async function(done) { it('AccessibilityConfigTest_set_asyncCallback_8000', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_8000'); console.info('AccessibilityConfigTest_set_asyncCallback_8000');
let value = 'Deuteranomaly'; config.daltonizationColorFilter.set('Deuteranomaly', (err, result) => {
config.daltonizationColorFilter.set(value, (err, result) => {
if (err.code != 0) { if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_8000 has error: ${err.code}`); console.error(`AccessibilityConfigTest_set_asyncCallback_8000 has error: ${err.code}`);
expect(null).assertFail(); expect(null).assertFail();
...@@ -1485,8 +1159,7 @@ export default function abilityTest() { ...@@ -1485,8 +1159,7 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncPromise_8100', 0, async function(done) { it('AccessibilityConfigTest_set_asyncPromise_8100', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_8100'); console.info('AccessibilityConfigTest_set_asyncPromise_8100');
let value = 'Protanomaly'; config.daltonizationColorFilter.set('Protanomaly').then((result) => {
config.daltonizationColorFilter.set(value).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_8100 result: ${result}`); console.info(`AccessibilityConfigTest_set_asyncPromise_8100 result: ${result}`);
expect(result).assertEqual(undefined); expect(result).assertEqual(undefined);
done(); done();
...@@ -1506,8 +1179,7 @@ export default function abilityTest() { ...@@ -1506,8 +1179,7 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncPromise_8200', 0, async function(done) { it('AccessibilityConfigTest_set_asyncPromise_8200', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_8200'); console.info('AccessibilityConfigTest_set_asyncPromise_8200');
let value = 'Tritanomaly'; config.daltonizationColorFilter.set('Tritanomaly').then((result) => {
config.daltonizationColorFilter.set(value).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_8200 result: ${result}`); console.info(`AccessibilityConfigTest_set_asyncPromise_8200 result: ${result}`);
expect(result).assertEqual(undefined); expect(result).assertEqual(undefined);
done(); done();
...@@ -1595,15 +1267,14 @@ export default function abilityTest() { ...@@ -1595,15 +1267,14 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncCallback_8700', 0, async function(done) { it('AccessibilityConfigTest_set_asyncCallback_8700', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncCallback_8700'); console.info('AccessibilityConfigTest_set_asyncCallback_8700');
let value = {}; config.captionsStyle.set({
value.fontFamily = 'default'; fontFamily: 'default',
value.fontScale = 10; fontScale: 10,
value.fontColor = 'blue'; fontColor: 'blue',
value.fontEdgeType = 'none'; fontEdgeType: 'none',
value.backgroundColor = 'blue'; backgroundColor: 'blue',
value.windowColor = 'blue'; windowColor: 'blue'
}, (err, result) => {
config.captionsStyle.set(value, (err, result) => {
if (err.code != 0) { if (err.code != 0) {
console.error(`AccessibilityConfigTest_set_asyncCallback_8700 has error: ${err.code}`); console.error(`AccessibilityConfigTest_set_asyncCallback_8700 has error: ${err.code}`);
expect(null).assertFail(); expect(null).assertFail();
...@@ -1623,15 +1294,14 @@ export default function abilityTest() { ...@@ -1623,15 +1294,14 @@ export default function abilityTest() {
*/ */
it('AccessibilityConfigTest_set_asyncPromise_8800', 0, async function(done) { it('AccessibilityConfigTest_set_asyncPromise_8800', 0, async function(done) {
console.info('AccessibilityConfigTest_set_asyncPromise_8800'); console.info('AccessibilityConfigTest_set_asyncPromise_8800');
let value = {}; config.captionsStyle.set({
value.fontFamily = 'default'; fontFamily: 'default',
value.fontScale = 10; fontScale: 10,
value.fontColor = 'blue'; fontColor: 'blue',
value.fontEdgeType = 'none'; fontEdgeType: 'none',
value.backgroundColor = 'blue'; backgroundColor: 'blue',
value.windowColor = 'blue'; windowColor: 'blue'
}).then((result) => {
config.captionsStyle.set(value).then((result) => {
console.info(`AccessibilityConfigTest_set_asyncPromise_8800 result: ${result}`); console.info(`AccessibilityConfigTest_set_asyncPromise_8800 result: ${result}`);
expect(result).assertEqual(undefined); expect(result).assertEqual(undefined);
done(); done();
...@@ -1720,8 +1390,7 @@ export default function abilityTest() { ...@@ -1720,8 +1390,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncCallback_9300', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncCallback_9300', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9300'); console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9300');
let name = ''; let name = '';
let capability = []; config.enableAbility(name, [], (err) => {
config.enableAbility(name, capability, (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9300 error: ${JSON.stringify(err)}`); console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9300 error: ${JSON.stringify(err)}`);
if (err.code != 0) { if (err.code != 0) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1742,8 +1411,7 @@ export default function abilityTest() { ...@@ -1742,8 +1411,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncCallback_9400', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncCallback_9400', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9400'); console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9400');
let name = 'test'; let name = 'test';
let capability = ['retrieve']; config.enableAbility(name, ['retrieve'], (err) => {
config.enableAbility(name, capability, (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9400 error: ${JSON.stringify(err)}`); console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9400 error: ${JSON.stringify(err)}`);
if (err.code != 0) { if (err.code != 0) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1764,8 +1432,7 @@ export default function abilityTest() { ...@@ -1764,8 +1432,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncCallback_9500', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncCallback_9500', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9500'); console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9500');
let name = 'test.com'; let name = 'test.com';
let capability = ['retrieve', 'touchGuide']; config.enableAbility(name, ['retrieve', 'touchGuide'], (err) => {
config.enableAbility(name, capability, (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9500 error: ${JSON.stringify(err)}`); console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9500 error: ${JSON.stringify(err)}`);
if (err.code != 0) { if (err.code != 0) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1786,8 +1453,7 @@ export default function abilityTest() { ...@@ -1786,8 +1453,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncCallback_9600', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncCallback_9600', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9600'); console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9600');
let name = 'com.test'; let name = 'com.test';
let capability = ['retrieve', 'touchGuide', 'keyEventObserver']; config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver'], (err) => {
config.enableAbility(name, capability, (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9600 error: ${JSON.stringify(err)}`); console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9600 error: ${JSON.stringify(err)}`);
if (err.code != 0) { if (err.code != 0) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1808,8 +1474,7 @@ export default function abilityTest() { ...@@ -1808,8 +1474,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncCallback_9700', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncCallback_9700', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9700'); console.info('AccessibilityConfigTest_enableAbility_asyncCallback_9700');
let name = 'com.'; let name = 'com.';
let capability = ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']; config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture'], (err) => {
config.enableAbility(name, capability, (err) => {
console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9700 error: ${JSON.stringify(err)}`); console.info(`AccessibilityConfigTest_enableAbility_asyncCallback_9700 error: ${JSON.stringify(err)}`);
if (err.code != 0) { if (err.code != 0) {
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1830,8 +1495,7 @@ export default function abilityTest() { ...@@ -1830,8 +1495,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncPromise_9800', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncPromise_9800', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800');
let name = ''; let name = '';
let capability = []; config.enableAbility(name, []).then(() => {
config.enableAbility(name, capability).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800 result back'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9800 result back');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
...@@ -1852,8 +1516,7 @@ export default function abilityTest() { ...@@ -1852,8 +1516,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncPromise_9900', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncPromise_9900', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900');
let name = 'test'; let name = 'test';
let capability = ['retrieve']; config.enableAbility(name, ['retrieve']).then(() => {
config.enableAbility(name, capability).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900 result back'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_9900 result back');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
...@@ -1874,8 +1537,7 @@ export default function abilityTest() { ...@@ -1874,8 +1537,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncPromise_10000', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncPromise_10000', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000');
let name = 'test.com'; let name = 'test.com';
let capability = ['retrieve', 'touchGuide']; config.enableAbility(name, ['retrieve', 'touchGuide']).then(() => {
config.enableAbility(name, capability).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000 result back'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10000 result back');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
...@@ -1896,8 +1558,7 @@ export default function abilityTest() { ...@@ -1896,8 +1558,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncPromise_10100', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncPromise_10100', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100');
let name = 'com.test'; let name = 'com.test';
let capability = ['retrieve', 'touchGuide', 'keyEventObserver']; config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver']).then(() => {
config.enableAbility(name, capability).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100 result back'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10100 result back');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
...@@ -1918,8 +1579,7 @@ export default function abilityTest() { ...@@ -1918,8 +1579,7 @@ export default function abilityTest() {
it('AccessibilityConfigTest_enableAbility_asyncPromise_10200', 0, async function(done) { it('AccessibilityConfigTest_enableAbility_asyncPromise_10200', 0, async function(done) {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200');
let name = 'com.'; let name = 'com.';
let capability = ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']; config.enableAbility(name, ['retrieve', 'touchGuide', 'keyEventObserver', 'zoom', 'gesture']).then(() => {
config.enableAbility(name, capability).then(() => {
console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200 result back'); console.info('AccessibilityConfigTest_enableAbility_asyncPromise_10200 result back');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
......
...@@ -78,9 +78,8 @@ export default function abilityTest() { ...@@ -78,9 +78,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0100', 0, async function (done) { it('AccessibilityEventTest_0100', 0, async function (done) {
console.info(`AccessibilityEventTest_0100`); console.info(`AccessibilityEventTest_0100`);
let eventType = 'accessibilityFocus';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'accessibilityFocus';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'accessibilityFocus'; event.triggerAction = 'accessibilityFocus';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -88,7 +87,7 @@ export default function abilityTest() { ...@@ -88,7 +87,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'accessibilityFocus') {
findResult = true; findResult = true;
} }
} }
...@@ -108,9 +107,8 @@ export default function abilityTest() { ...@@ -108,9 +107,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0200', 0, async function (done) { it('AccessibilityEventTest_0200', 0, async function (done) {
console.info(`AccessibilityEventTest_0200`); console.info(`AccessibilityEventTest_0200`);
let eventType = 'accessibilityFocusClear';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'accessibilityFocusClear';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'clearAccessibilityFocus'; event.triggerAction = 'clearAccessibilityFocus';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -118,7 +116,7 @@ export default function abilityTest() { ...@@ -118,7 +116,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'accessibilityFocusClear') {
findResult = true; findResult = true;
} }
} }
...@@ -138,9 +136,8 @@ export default function abilityTest() { ...@@ -138,9 +136,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0300', 0, async function (done) { it('AccessibilityEventTest_0300', 0, async function (done) {
console.info(`AccessibilityEventTest_0300`); console.info(`AccessibilityEventTest_0300`);
let eventType = 'click';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'click';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'click'; event.triggerAction = 'click';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -148,7 +145,7 @@ export default function abilityTest() { ...@@ -148,7 +145,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'click') {
findResult = true; findResult = true;
} }
} }
...@@ -168,9 +165,8 @@ export default function abilityTest() { ...@@ -168,9 +165,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0400', 0, async function (done) { it('AccessibilityEventTest_0400', 0, async function (done) {
console.info(`AccessibilityEventTest_0400`); console.info(`AccessibilityEventTest_0400`);
let eventType = 'longClick';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'longClick';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'longClick'; event.triggerAction = 'longClick';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -178,7 +174,7 @@ export default function abilityTest() { ...@@ -178,7 +174,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'longClick') {
findResult = true; findResult = true;
} }
} }
...@@ -198,9 +194,8 @@ export default function abilityTest() { ...@@ -198,9 +194,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0500', 0, async function (done) { it('AccessibilityEventTest_0500', 0, async function (done) {
console.info(`AccessibilityEventTest_0500`); console.info(`AccessibilityEventTest_0500`);
let eventType = 'focus';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'focus';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'focus'; event.triggerAction = 'focus';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -208,7 +203,7 @@ export default function abilityTest() { ...@@ -208,7 +203,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'focus') {
findResult = true; findResult = true;
} }
} }
...@@ -228,9 +223,8 @@ export default function abilityTest() { ...@@ -228,9 +223,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0600', 0, async function (done) { it('AccessibilityEventTest_0600', 0, async function (done) {
console.info(`AccessibilityEventTest_0600`); console.info(`AccessibilityEventTest_0600`);
let eventType = 'select';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'select';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'select'; event.triggerAction = 'select';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -238,7 +232,7 @@ export default function abilityTest() { ...@@ -238,7 +232,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'select') {
findResult = true; findResult = true;
} }
} }
...@@ -258,9 +252,8 @@ export default function abilityTest() { ...@@ -258,9 +252,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0700', 0, async function (done) { it('AccessibilityEventTest_0700', 0, async function (done) {
console.info(`AccessibilityEventTest_0700`); console.info(`AccessibilityEventTest_0700`);
let eventType = 'hoverEnter';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'hoverEnter';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'focus'; event.triggerAction = 'focus';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -268,7 +261,7 @@ export default function abilityTest() { ...@@ -268,7 +261,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'hoverEnter') {
findResult = true; findResult = true;
} }
} }
...@@ -288,9 +281,8 @@ export default function abilityTest() { ...@@ -288,9 +281,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0800', 0, async function (done) { it('AccessibilityEventTest_0800', 0, async function (done) {
console.info(`AccessibilityEventTest_0800`); console.info(`AccessibilityEventTest_0800`);
let eventType = 'hoverExit';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'hoverExit';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'focus'; event.triggerAction = 'focus';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -298,7 +290,7 @@ export default function abilityTest() { ...@@ -298,7 +290,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'hoverExit') {
findResult = true; findResult = true;
} }
} }
...@@ -318,9 +310,8 @@ export default function abilityTest() { ...@@ -318,9 +310,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_0900', 0, async function (done) { it('AccessibilityEventTest_0900', 0, async function (done) {
console.info(`AccessibilityEventTest_0900`); console.info(`AccessibilityEventTest_0900`);
let eventType = 'textUpdate';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'textUpdate';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'cut'; event.triggerAction = 'cut';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -328,7 +319,7 @@ export default function abilityTest() { ...@@ -328,7 +319,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'textUpdate') {
findResult = true; findResult = true;
} }
} }
...@@ -348,9 +339,8 @@ export default function abilityTest() { ...@@ -348,9 +339,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_1000', 0, async function (done) { it('AccessibilityEventTest_1000', 0, async function (done) {
console.info(`AccessibilityEventTest_1000`); console.info(`AccessibilityEventTest_1000`);
let eventType = 'textSelectionUpdate';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'textSelectionUpdate';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'setSelection'; event.triggerAction = 'setSelection';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -358,7 +348,7 @@ export default function abilityTest() { ...@@ -358,7 +348,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'textSelectionUpdate') {
findResult = true; findResult = true;
} }
} }
...@@ -378,9 +368,8 @@ export default function abilityTest() { ...@@ -378,9 +368,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_1100', 0, async function (done) { it('AccessibilityEventTest_1100', 0, async function (done) {
console.info(`AccessibilityEventTest_1100`); console.info(`AccessibilityEventTest_1100`);
let eventType = 'scroll';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'scroll';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'scrollForward'; event.triggerAction = 'scrollForward';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -388,7 +377,7 @@ export default function abilityTest() { ...@@ -388,7 +377,7 @@ export default function abilityTest() {
setTimeout(() => { setTimeout(() => {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
if (item.eventType == eventType) { if (item.eventType == 'scroll') {
findResult = true; findResult = true;
} }
} }
...@@ -408,9 +397,8 @@ export default function abilityTest() { ...@@ -408,9 +397,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_1200', 0, async function (done) { it('AccessibilityEventTest_1200', 0, async function (done) {
console.info(`AccessibilityEventTest_1200`); console.info(`AccessibilityEventTest_1200`);
let eventType = 'scroll';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'scroll';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'scrollForward'; event.triggerAction = 'scrollForward';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -419,7 +407,7 @@ export default function abilityTest() { ...@@ -419,7 +407,7 @@ export default function abilityTest() {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
console.info(`AccessibilityEventTest_1200 haveTarget: ${item.haveTarget}`); console.info(`AccessibilityEventTest_1200 haveTarget: ${item.haveTarget}`);
if (item.eventType == eventType && item.haveTarget) { if (item.eventType == 'scroll' && item.haveTarget) {
findResult = true; findResult = true;
} }
} }
...@@ -439,9 +427,8 @@ export default function abilityTest() { ...@@ -439,9 +427,8 @@ export default function abilityTest() {
*/ */
it('AccessibilityEventTest_1300', 0, async function (done) { it('AccessibilityEventTest_1300', 0, async function (done) {
console.info(`AccessibilityEventTest_1300`); console.info(`AccessibilityEventTest_1300`);
let eventType = 'scroll';
let event = new accessibility.EventInfo({}); let event = new accessibility.EventInfo({});
event.type = eventType; event.type = 'scroll';
event.bundleName = targetBundleName; event.bundleName = targetBundleName;
event.triggerAction = 'scrollForward'; event.triggerAction = 'scrollForward';
await accessibility.sendEvent(event); await accessibility.sendEvent(event);
...@@ -450,7 +437,7 @@ export default function abilityTest() { ...@@ -450,7 +437,7 @@ export default function abilityTest() {
let findResult = false; let findResult = false;
for (let item of events) { for (let item of events) {
console.info(`AccessibilityEventTest_1300 timeStamp: ${item.timeStamp}`); console.info(`AccessibilityEventTest_1300 timeStamp: ${item.timeStamp}`);
if (item.eventType == eventType && typeof(item.timeStamp) == 'number') { if (item.eventType == 'scroll' && typeof(item.timeStamp) == 'number') {
findResult = true; findResult = true;
} }
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAccessibilityGestureEventTest") { ohos_js_hap_suite("ActsAccessibilityGestureEventTest") {
hap_profile = "entry/src/main/module.json" hap_profile = "./entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
deps = [ deps = [
":accessibilitygestureevent_js_assets", ":accessibilitygestureevent_js_assets",
...@@ -33,11 +33,11 @@ ohos_app_scope("accessibilitygestureevent_app_profile") { ...@@ -33,11 +33,11 @@ ohos_app_scope("accessibilitygestureevent_app_profile") {
} }
ohos_js_assets("accessibilitygestureevent_js_assets") { ohos_js_assets("accessibilitygestureevent_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "./entry/src/main/ets"
} }
ohos_resources("accessibilitygestureevent_resources") { ohos_resources("accessibilitygestureevent_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "./entry/src/main/resources" ]
deps = [ ":accessibilitygestureevent_app_profile" ] deps = [ ":accessibilitygestureevent_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "./entry/src/main/module.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "180000", "test-timeout": "180000",
"package": "com.example.myapplication", "bundle-name": "com.example.myapplication",
"shell-timeout": "180000" "module-name": "phone",
"shell-timeout": "180000",
"testcase-timeout": 70000
}, },
"kits": [ "kits": [
{ {
......
/*
* Copyright (c) 2022 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 Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want,launchParam){ onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability // Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate") console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want; globalThis.abilityWant = want;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
} }
onDestroy() { onDestroy() {
...@@ -14,11 +37,11 @@ export default class MainAbility extends Ability { ...@@ -14,11 +37,11 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) console.log("[Demo] MainAbility onWindowStageCreate windowStage=" + windowStage)
//globalThis.windowStage = windowStage //globalThis.windowStage = windowStage
//globalThis.abilityStorage = this.storage //globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null) windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
} }
onWindowStageDestroy() { onWindowStageDestroy() {
...@@ -35,4 +58,4 @@ export default class MainAbility extends Ability { ...@@ -35,4 +58,4 @@ export default class MainAbility extends Ability {
// Ability has back to background // Ability has back to background
console.log("[Demo] MainAbility onBackground") console.log("[Demo] MainAbility onBackground")
} }
}; };
\ No newline at end of file
...@@ -12,10 +12,7 @@ ...@@ -12,10 +12,7 @@
* 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 router from '@ohos.router';
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test"
@Entry @Entry
@Component @Component
...@@ -24,22 +21,6 @@ struct Index { ...@@ -24,22 +21,6 @@ struct Index {
aboutToAppear(){ aboutToAppear(){
console.info("start run testcase!!!!"); console.info("start run testcase!!!!");
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters));
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters);
testsuite(globalThis.abilityContext);
core.execute();
} }
build() { build() {
......
/*
* Copyright (c) 2022 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 Ability from '@ohos.application.Ability'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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 router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* 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 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
function publishCaseExecute(caseName: string) { function publishCaseExecute(caseName: string) {
...@@ -25,7 +25,7 @@ function publishCaseExecute(caseName: string) { ...@@ -25,7 +25,7 @@ function publishCaseExecute(caseName: string) {
}); });
} }
export default function abilityTest(abilityContext) { export default function abilityTest() {
let gestureEventTypes: Array<string> = []; let gestureEventTypes: Array<string> = [];
describe('AccessibilityGestureEventTest', function () { describe('AccessibilityGestureEventTest', function () {
let subScriber = undefined; let subScriber = undefined;
...@@ -45,7 +45,7 @@ export default function abilityTest(abilityContext) { ...@@ -45,7 +45,7 @@ export default function abilityTest(abilityContext) {
} }
}); });
await abilityContext.startAbility({ await globalThis.abilityContext.startAbility({
deviceId: '', deviceId: '',
bundleName: 'com.example.acetest', bundleName: 'com.example.acetest',
abilityName: 'MainAbility', abilityName: 'MainAbility',
......
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
*/ */
import abilityTest from './AccessibilityGestureEventTest.test.ets' import abilityTest from './AccessibilityGestureEventTest.test.ets'
export default function testsuite(abilityContext) { export default function testsuite() {
abilityTest(abilityContext) abilityTest()
} }
\ No newline at end of file
{ {
"src": [ "src": [
"pages/index/index" "MainAbility/pages/index/index"
] ]
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册