提交 296dcff0 编写于 作者: M Mupceet

fix resource freeze bug

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 3340388b
......@@ -11,18 +11,10 @@
"kits": [
{
"test-file-name": [
"aceTest.hap",
"ActsAccessibilityElementTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n com.example.accessibilityxts",
"bm uninstall -n com.example.acetest"
]
}
]
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ import router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
@State message: string = 'accessibility element';
aboutToAppear(){
console.info("start run testcase!!!!");
......@@ -27,8 +27,26 @@ struct Index {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({bottom: 10})
Row() {
Button('left')
Button('button1')
.margin({
left: 10,
right: 10
})
Button('right')
}
.margin({bottom: 10})
Button('button2')
.margin({bottom: 10})
Button('button3')
.margin({bottom: 10})
}
.width('100%')
}
......
......@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import commonEvent from '@ohos.commonEvent'
import config from '@ohos.accessibility.config'
const passStr = 'pass';
const failStr = 'fail';
......@@ -48,21 +49,40 @@ export default function abilityTest() {
}
});
await globalThis.abilityContext.startAbility({
deviceId: '',
bundleName: 'com.example.acetest',
abilityName: 'MainAbility',
action: 'action1',
parameters: {},
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityElementTest enableAbility: then`);
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility1',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityElementTest1 enableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityElementTest1 enableAbility has error: ${err.code}`);
});
setTimeout(done, 5000);
}).catch((err) => {
console.error(`AccessibilityElementTest enableAbility has error: ${err.code}`);
});
setTimeout(async () => {
done();
}, 5000);
})
afterAll(async function (done) {
console.info('AccessibilityElementTest: afterAll');
commonEvent.unsubscribe(subScriber);
isConnect = false;
done();
config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => {
console.info(`AccessibilityElementTest disableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityElementTest disableAbility has error: ${err.code}`);
});
setTimeout(async () => {
done();
}, 5000);
})
beforeEach(async function (done) {
......
......@@ -11,18 +11,10 @@
"kits": [
{
"test-file-name": [
"aceTest.hap",
"ActsAccessibilityEventTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n com.example.accessibilityxts",
"bm uninstall -n com.example.acetest"
]
}
]
}
\ No newline at end of file
......@@ -15,6 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import accessibility from '@ohos.accessibility'
import commonEvent from '@ohos.commonEvent'
import config from '@ohos.accessibility.config'
export default function abilityTest() {
let targetBundleName = 'com.example.accessibilityxts';
......@@ -37,23 +38,27 @@ export default function abilityTest() {
}
});
setTimeout(async () => {
await globalThis.abilityContext.startAbility({
deviceId: "",
bundleName: "com.example.acetest",
abilityName: "MainAbility",
action: "action1",
parameters: {},
});
done();
}, 5000);
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityEventTest enableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityEventTest enableAbility has error: ${err.code}`);
});
setTimeout(done, 5000);
})
afterAll(async function (done) {
console.info('AccessibilityEventTest: afterAll');
commonEvent.unsubscribe(subScriber);
isConnected = false;
done();
config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => {
console.info(`AccessibilityEventTest disableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityEventTest disableAbility has error: ${err.code}`);
});
setTimeout(done, 5000);
})
beforeEach(async function (done) {
......
......@@ -11,18 +11,10 @@
"kits": [
{
"test-file-name": [
"aceTest.hap",
"ActsAccessibilityExtensionTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n com.example.accessibilityxts",
"bm uninstall -n com.example.acetest"
]
}
]
}
\ No newline at end of file
......@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import commonEvent from '@ohos.commonEvent'
import config from '@ohos.accessibility.config'
export default function abilityTest() {
let isCalled: boolean = false;
......@@ -57,12 +58,12 @@ export default function abilityTest() {
*/
it('AccessibilityExtensionTest_Connect_0100', 0, async function (done) {
console.info('AccessibilityExtensionTest_Connect_0100: start');
await globalThis.abilityContext.startAbility({
deviceId: "",
bundleName: "com.example.acetest",
abilityName: "MainAbility",
action: "action1",
parameters: {},
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityExtensionTest enableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityExtensionTest enableAbility has error: ${err.code}`);
});
setTimeout(() => {
......@@ -82,11 +83,10 @@ export default function abilityTest() {
*/
it('AccessibilityExtensionTest_Disconnect_0200', 0, async function (done) {
console.info('AccessibilityExtensionTest_Disconnect_0200 start');
let commonEventPublishData = {
data: 'disable'
}
commonEvent.publish('disableExtAbility', commonEventPublishData, (err) => {
console.info("AccessibilityExtensionTest_Disconnect_0200 publish event: " + JSON.stringify(commonEventPublishData));
config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => {
console.info(`AccessibilityExtensionTest disableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityExtensionTest disableAbility has error: ${err.code}`);
});
setTimeout(() => {
......
......@@ -11,18 +11,10 @@
"kits": [
{
"test-file-name": [
"aceTest.hap",
"ActsAccessibilityExtensionContextTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n com.example.accessibilityxts",
"bm uninstall -n com.example.acetest"
]
}
]
}
......@@ -18,7 +18,7 @@ import file from '@system.file';
@Entry
@Component
struct Index {
@State message: string = 'Extension Context';
@State message: string = 'accessibility ExtensionContext';
aboutToAppear(){
console.info("start run testcase!!!!");
......@@ -28,8 +28,26 @@ struct Index {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({bottom: 10})
Row() {
Button('left')
Button('button1')
.margin({
left: 10,
right: 10
})
Button('right')
}
.margin({bottom: 10})
Button('button2')
.margin({bottom: 10})
Button('button3')
.margin({bottom: 10})
}
.width('100%')
}
......
......@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import commonEvent from '@ohos.commonEvent'
import config from '@ohos.accessibility.config'
const passStr = 'pass';
const failStr = 'fail';
......@@ -48,21 +49,27 @@ export default function abilityTest() {
}
});
await globalThis.abilityContext.startAbility({
deviceId: '',
bundleName: 'com.example.acetest',
abilityName: 'MainAbility',
action: 'action1',
parameters: {},
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityExtensionContextTest enableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityExtensionContextTest enableAbility has error: ${err.code}`);
});
setTimeout(done, 3000);
setTimeout(done, 5000);
})
afterAll(async function (done) {
console.info('AccessibilityElementTest: afterAll');
commonEvent.unsubscribe(subScriber);
isConnect = false;
done();
config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => {
console.info(`AccessibilityExtensionContextTest disableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityExtensionContextTest disableAbility has error: ${err.code}`);
});
setTimeout(done, 5000);
})
beforeEach(async function (done) {
......
......@@ -11,18 +11,10 @@
"kits": [
{
"test-file-name": [
"aceTest.hap",
"ActsAccessibilityGestureEventTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n com.example.accessibilityxts",
"bm uninstall -n com.example.acetest"
]
}
]
}
......@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
import config from '@ohos.accessibility.config'
function publishCaseExecute(caseName: string) {
let commonEventPublishData = {
......@@ -45,21 +46,26 @@ export default function abilityTest() {
}
});
await globalThis.abilityContext.startAbility({
deviceId: '',
bundleName: 'com.example.acetest',
abilityName: 'MainAbility',
action: 'action1',
parameters: {},
config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility',
["retrieve", "touchGuide", "gesture"]
).then(() => {
console.info(`AccessibilityGestureEventTest enableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityGestureEventTest enableAbility has error: ${err.code}`);
});
setTimeout(done, 3000);
})
afterAll(async function (done) {
console.info('AccessibilityGestureEventTest: afterAll');
commonEvent.unsubscribe(subScriber);
isConnect = false;
done();
config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => {
console.info(`AccessibilityGestureEventTest disableAbility: then`);
}).catch((err) => {
console.error(`AccessibilityGestureEventTest disableAbility has error: ${err.code}`);
});
setTimeout(done, 5000);
})
beforeEach(async function (done) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册