Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b4cbbf8d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b4cbbf8d
编写于
1月 17, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 17, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7251 xts-系统api下库
Merge pull request !7251 from chengxingzhen/master
上级
1fd27a4b
6814c0eb
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
868 deletion
+0
-868
ability/ability_runtime/context/actsstagecontext/actsstagecontextassisttwo/entry/src/main/ets/Application/MyAbilityStage.ts
...ssisttwo/entry/src/main/ets/Application/MyAbilityStage.ts
+0
-26
ability/ability_runtime/context/actsstagecontext/actsstagecontextassisttwo/entry/src/main/ets/MainAbility/MainAbility.ts
...xtassisttwo/entry/src/main/ets/MainAbility/MainAbility.ts
+0
-23
ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets
...t/entry/src/main/ets/test/StageContextProperties.test.ets
+0
-572
ability/ability_runtime/context/actsstagecontexttest/entry/src/main/ets/test/ActsStageContextTest.test.ets
...est/entry/src/main/ets/test/ActsStageContextTest.test.ets
+0
-247
未找到文件。
ability/ability_runtime/context/actsstagecontext/actsstagecontextassisttwo/entry/src/main/ets/Application/MyAbilityStage.ts
浏览文件 @
b4cbbf8d
...
...
@@ -49,36 +49,10 @@ export default class MyAbilityStage extends AbilityStage {
'
preferencesDir
'
:
stageAppContext
.
preferencesDir
,
'
bundleCodeDir
'
:
stageAppContext
.
bundleCodeDir
};
let
bundleContext
=
globalThis
.
abilityStageContextB
.
createBundleContext
(
"
com.example.actsstagecontextassisttwo
"
);
let
result
=
await
bundleContext
.
resourceManager
.
getString
(
16777219
)
let
appBundleContext
=
stageAppContext
.
createBundleContext
(
"
com.example.actsstagecontextassisttwo
"
);
let
result1
=
await
appBundleContext
.
resourceManager
.
getString
(
16777219
)
console
.
log
(
"
ActsStageContextAssistTwo getLabel
"
+
JSON
.
stringify
(
result1
))
let
stageBundleContextJson
=
{
'
cacheDir
'
:
bundleContext
.
cacheDir
,
'
tempDir
'
:
bundleContext
.
tempDir
,
'
filesDir
'
:
bundleContext
.
filesDir
,
'
distributedFilesDir
'
:
bundleContext
.
distributedFilesDir
,
'
databaseDir
'
:
bundleContext
.
databaseDir
,
'
preferencesDir
'
:
bundleContext
.
preferencesDir
,
'
bundleCodeDir
'
:
bundleContext
.
bundleCodeDir
};
let
stageAppBundleContextJson
=
{
'
cacheDir
'
:
appBundleContext
.
cacheDir
,
'
tempDir
'
:
appBundleContext
.
tempDir
,
'
filesDir
'
:
appBundleContext
.
filesDir
,
'
distributedFilesDir
'
:
appBundleContext
.
distributedFilesDir
,
'
databaseDir
'
:
appBundleContext
.
databaseDir
,
'
preferencesDir
'
:
appBundleContext
.
preferencesDir
,
'
bundleCodeDir
'
:
appBundleContext
.
bundleCodeDir
};
let
commonEventData
=
{
parameters
:
{
abilityStageContextAssistOne
:
stageContextJson
,
abilityStageAppContextAssistOne
:
stageAppContextJson
,
abilityStageLabel
:
result
,
abilityStageAppLabel
:
result1
,
abilityStageBundleContxtAssistOne
:
stageBundleContextJson
,
abilityStageAppBundleContextAssistOne
:
stageAppBundleContextJson
}
}
commonEvent
.
publish
(
"
AssistContextTwo_StageAbilityA_Start_CommonEvent
"
,
commonEventData
,
()
=>
{
...
...
ability/ability_runtime/context/actsstagecontext/actsstagecontextassisttwo/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
b4cbbf8d
...
...
@@ -15,8 +15,6 @@
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
import
bundle
from
'
@ohos.bundle
'
;
import
dataAbility
from
'
@ohos.data.dataAbility
'
;
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
:
any
,
launchParam
:
any
)
{
...
...
@@ -52,24 +50,6 @@ export default class MainAbility extends Ability {
'
preferencesDir
'
:
abilityAppContext
.
preferencesDir
,
'
bundleCodeDir
'
:
abilityAppContext
.
bundleCodeDir
};
let
bundleContext
=
this
.
context
.
createBundleContext
(
"
com.example.actsstagecontextassisttwo
"
)
let
bundleAppContext
=
abilityAppContext
.
createBundleContext
(
"
com.example.actsstagecontextassisttwo
"
)
let
result
=
await
bundleContext
.
resourceManager
.
getString
(
16777219
)
let
bundleContextJson
=
{
'
cacheDir
'
:
bundleContext
.
cacheDir
,
'
tempDir
'
:
bundleContext
.
tempDir
,
'
filesDir
'
:
bundleContext
.
filesDir
,
'
distributedFilesDir
'
:
bundleContext
.
distributedFilesDir
,
'
databaseDir
'
:
bundleContext
.
databaseDir
,
'
preferencesDir
'
:
bundleContext
.
preferencesDir
,
'
bundleCodeDir
'
:
bundleContext
.
bundleCodeDir
};
let
appBundleContextJson
=
{
'
cacheDir
'
:
bundleAppContext
.
cacheDir
,
'
tempDir
'
:
bundleAppContext
.
tempDir
,
'
filesDir
'
:
bundleAppContext
.
filesDir
,
'
distributedFilesDir
'
:
bundleAppContext
.
distributedFilesDir
,
'
databaseDir
'
:
bundleAppContext
.
databaseDir
,
'
preferencesDir
'
:
bundleAppContext
.
preferencesDir
,
'
bundleCodeDir
'
:
bundleAppContext
.
bundleCodeDir
};
let
errCode
;
try
{
...
...
@@ -83,9 +63,6 @@ export default class MainAbility extends Ability {
parameters
:
{
abilityContextAssistTwo
:
contextJson
,
abilityAppContextAssistTwo
:
appContextJson
,
abilityLabel
:
result
,
abilityBundleContextAssistTwo
:
bundleContextJson
,
abilityAppBundleContextAssistTwo
:
appBundleContextJson
,
abilityBundleContextTest
:
errCode
}
}
...
...
ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets
浏览文件 @
b4cbbf8d
此差异已折叠。
点击以展开。
ability/ability_runtime/context/actsstagecontexttest/entry/src/main/ets/test/ActsStageContextTest.test.ets
浏览文件 @
b4cbbf8d
...
...
@@ -150,139 +150,6 @@ export default function actsStageContextTest() {
})
})
/*
* @tc.number : ACTS_StageContext_0800
* @tc.name : get resource by Resource in applicationInfo
* @tc.desc : get resource by Resource in applicationInfo
*/
it('ACTS_StageContext_0800',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.stage_app", 0).then(appInfo => {
return globalThis.abilityContext.createModuleContext("module1").resourceManager.getString(appInfo.labelResource)
}).then(str => {
console.info("ACTS_StageContext_0800 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_0800 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_0900
* @tc.name : get resource by labelId in applicationInfo from bundle context
* @tc.desc : get resource by labelId in applicationInfo from bundle context
*/
it('ACTS_StageContext_0900',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.stage_app", 0).then(appInfo => {
return globalThis.abilityContext.createBundleContext("com.example.stage_app").resourceManager.getString(appInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_0900 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_0900 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1000
* @tc.name : get resource by labelId in applicationInfo from moduleContext
* @tc.desc : get resource by labelId in applicationInfo from moduleContext
*/
it('ACTS_StageContext_1000',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.stage_app", 0).then(appInfo => {
return globalThis.abilityContext.createModuleContext("com.example.stage_app", "entry").resourceManager.getString(appInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1000 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_1000 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1100
* @tc.name : get resource by labelId in abilityInfo from bundleContext
* @tc.desc : get resource by labelId in abilityInfo from bundleContext
*/
it('ACTS_StageContext_1100',0, async function (done) {
await bundle.getAbilityInfo("com.example.stage_app", "MainAbility").then(abilityInfo => {
return globalThis.abilityContext.createBundleContext("com.example.stage_app").resourceManager.getString(abilityInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1100 labelId: " + str)
expect(str).assertEqual("module1_label")
done()
}).catch(e => {
console.info("ACTS_StageContext_1100 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1200
* @tc.name : get resource by labelId in abilityInfo from moduleContext
* @tc.desc : get resource by labelId in abilityInfo from moduleContext
*/
it('ACTS_StageContext_1200',0, async function (done) {
await bundle.getAbilityInfo("com.example.stage_app", "MainAbility").then(abilityInfo => {
return globalThis.abilityContext.createModuleContext("com.example.stage_app", "entry").resourceManager.getString(abilityInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1200 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_1200 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1300
* @tc.name : get resource by Resource in applicationInfo from bundleContext
* @tc.desc : get resource by Resource in applicationInfo from bundleContext
*/
it('ACTS_StageContext_1300',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.stage_app", 0).then(appInfo => {
return globalThis.abilityContext.createBundleContext("com.example.stage_app").resourceManager.getString(appInfo.labelResource)
}).then(str => {
console.info("ACTS_StageContext_1300 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_1300 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1400
* @tc.name : get resource by Resource in applicationInfo from moduleContext
* @tc.desc : get resource by Resource in applicationInfo from moduleContext
*/
it('ACTS_StageContext_1400',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.stage_app", 0).then(appInfo => {
return globalThis.abilityContext.createModuleContext("com.example.stage_app", "entry").resourceManager.getString(appInfo.labelResource)
}).then(str => {
console.info("ACTS_StageContext_1400 labelId: " + str)
expect(str).assertEqual("stage_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_1400 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1500
* @tc.name : get resource by Resource in applicationInfo from context(API8)
...
...
@@ -302,101 +169,6 @@ export default function actsStageContextTest() {
})
})
/*
* @tc.number : ACTS_StageContext_1600
* @tc.name : get resource by labelId in applicationInfo from bundle context
* @tc.desc : get resource by labelId in applicationInfo from bundle context
*/
it('ACTS_StageContext_1600',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.contextapp", 0).then(appInfo => {
return globalThis.abilityContext.createBundleContext("com.example.contextapp").resourceManager.getString(appInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1600 labelId: " + str)
expect(str).assertEqual("ContextApp")
done()
}).catch(e => {
console.info("ACTS_StageContext_1600 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1700
* @tc.name : get resource by labelId in applicationInfo from moduleContext
* @tc.desc : get resource by labelId in applicationInfo from moduleContext
*/
it('ACTS_StageContext_1700',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.contextapp", 0).then(appInfo => {
return globalThis.abilityContext.createModuleContext("com.example.contextapp", "entry").resourceManager.getString(appInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1700 labelId: " + str)
expect(str).assertEqual("ContextApp")
done()
}).catch(e => {
console.info("ACTS_StageContext_1700 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_1900
* @tc.name : get resource by labelId in abilityInfo from moduleContext
* @tc.desc : get resource by labelId in abilityInfo from moduleContext
*/
it('ACTS_StageContext_1900',0, async function (done) {
await bundle.getAbilityInfo("com.example.contextapp", "MainAbility").then(abilityInfo => {
return globalThis.abilityContext.createModuleContext("com.example.contextapp", "entry").resourceManager.getString(abilityInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_1900 labelId: " + str)
expect(str).assertEqual("context_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_1900 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_2000
* @tc.name : get resource by Resource in applicationInfo from bundleContext
* @tc.desc : get resource by Resource in applicationInfo from bundleContext
*/
it('ACTS_StageContext_2000',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.contextapp", 0).then(appInfo => {
return globalThis.abilityContext.createBundleContext("com.example.contextapp").resourceManager.getString(appInfo.labelResource)
}).then(str => {
console.info("ACTS_StageContext_2000 labelId: " + str)
expect(str).assertEqual("ContextApp")
done()
}).catch(e => {
console.info("ACTS_StageContext_2000 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_2100
* @tc.name : get resource by Resource in applicationInfo from moduleContext
* @tc.desc : get resource by Resource in applicationInfo from moduleContext
*/
it('ACTS_StageContext_2100',0, async function (done) {
await bundleManager.getApplicationInfo("com.example.contextapp", 0).then(appInfo => {
return globalThis.abilityContext.createModuleContext("com.example.contextapp", "entry").resourceManager.getString(appInfo.labelResource)
}).then(str => {
console.info("ACTS_StageContext_2100 labelId: " + str)
expect(str).assertEqual("ContextApp")
done()
}).catch(e => {
console.info("ACTS_StageContext_2100 error: " + e)
expect().assertFail()
done()
})
})
/*
* @tc.number : ACTS_StageContext_2200
* @tc.name : get resource by Resource in applicationInfo from context
...
...
@@ -415,24 +187,5 @@ export default function actsStageContextTest() {
done()
})
})
/*
* @tc.number : ACTS_StageContext_2300
* @tc.name : get resource by Resource in applicationInfo from context(API8)
* @tc.desc : get resource by Resource in applicationInfo from context(API8)
*/
it('ACTS_StageContext_2300',0, async function (done) {
await bundle.getAbilityInfo("com.example.fa8_app", "com.example.entry.MainAbility").then(abilityInfo => {
return globalThis.abilityContext.createModuleContext("com.example.fa8_app", "entry").resourceManager.getString(abilityInfo.labelId)
}).then(str => {
console.info("ACTS_StageContext_2300 labelId: " + str)
expect(str).assertEqual("fa8_app")
done()
}).catch(e => {
console.info("ACTS_StageContext_2300 error: " + e)
expect().assertFail()
done()
})
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录