提交 e8d6173d 编写于 作者: S songjindian

修复context测试用例获取string值错误

Signed-off-by: Nsongjindian <songjindian1@huawei.com>
上级 626fd54d
......@@ -19,5 +19,6 @@ export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.info("MyAbilityStageMonitor onCreate")
globalThis.abilityStageContext = this.context
globalThis.abilityStageContextRes = this.context.createModuleContext('entry_test')
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ export default class MainAbility extends Ability {
console.log("ActsStageContextPropertiesTest MainAbility onCreate")
globalThis.abilityWant = want;
globalThis.abilityContext = this.context
globalThis.abilityContextRes = this.context.createModuleContext('entry_test')
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
......
......@@ -398,7 +398,7 @@ export default function stageContextPropertiesTest(abilityContext) {
it('SUB_AA_OpenHarmony_Context_0900', 0, async function (done) {
TAG = "SUB_AA_OpenHarmony_Context_0900"
console.log(TAG + " --- start");
let result = await abilityContext.resourceManager.getString(16777219);
let result = await globalThis.abilityContextRes.resourceManager.getString(16777219);
console.log(TAG + " : result = " + JSON.stringify(result));
expect(result).assertEqual("entry_MainAbility");
done();
......@@ -413,7 +413,7 @@ export default function stageContextPropertiesTest(abilityContext) {
it('SUB_AA_OpenHarmony_Context_1000', 0, async function (done) {
TAG = "SUB_AA_OpenHarmony_Context_1000"
console.log(TAG + " --- start");
let result = await globalThis.abilityStageContext.resourceManager.getString(16777219);
let result = await globalThis.abilityStageContextRes.resourceManager.getString(16777219);
console.log(TAG + " : result = " + JSON.stringify(result));
expect(result).assertEqual("entry_MainAbility");
done();
......@@ -428,10 +428,10 @@ export default function stageContextPropertiesTest(abilityContext) {
it('SUB_AA_OpenHarmony_Context_1100', 0, async function (done) {
TAG = "SUB_AA_OpenHarmony_Context_1100"
console.log(TAG + " --- start");
let result = await globalThis.abilityStageContext.getApplicationContext()
let result = await globalThis.abilityStageContextRes.getApplicationContext()
.resourceManager.getString(16777219);
console.log(TAG + " : result = " + JSON.stringify(result));
expect(result).assertEqual("entry_MainAbility");
expect(result).assertEqual("feature_MainAbility");
done();
});
......@@ -448,9 +448,11 @@ export default function stageContextPropertiesTest(abilityContext) {
async function SubscribeCallBack(err, data) {
console.log(TAG + " Subscribe CallBack data: " + JSON.stringify(data)
+ "err: " + JSON.stringify(err));
let result = await globalThis.abilityContextA.resourceManager.getString(16777219);
console.log(TAG + " : result = " + JSON.stringify(result));
expect(result).assertEqual("entry_MainAbility");
console.log(TAG, JSON.stringify(globalThis.abilityContextA))
console.log(TAG, JSON.stringify(globalThis.abilityContextA.resourceManager))
let result = globalThis.abilityContextA.resourceManager.getStringSync(16777219);
console.log(TAG + " : results = " + JSON.stringify(result));
expect(result).assertEqual("feature_MainAbility");
checkContextDirEqualB(abilityContext, globalThis.abilityContextA)
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册