Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c9ec06d9
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看板
未验证
提交
c9ec06d9
编写于
7月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9321 完成graphic子系统window模块的跨平台测试套
Merge pull request !9321 from huyanqiang/master
上级
89b6ddcf
28afd11b
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
3147 addition
and
0 deletion
+3147
-0
graphic/BUILD.gn
graphic/BUILD.gn
+1
-0
graphic/crossplatform/window/AppScope/app.json
graphic/crossplatform/window/AppScope/app.json
+16
-0
graphic/crossplatform/window/AppScope/resources/base/element/string.json
...atform/window/AppScope/resources/base/element/string.json
+8
-0
graphic/crossplatform/window/AppScope/resources/base/media/app_icon.png
...latform/window/AppScope/resources/base/media/app_icon.png
+0
-0
graphic/crossplatform/window/BUILD.gn
graphic/crossplatform/window/BUILD.gn
+39
-0
graphic/crossplatform/window/Test.json
graphic/crossplatform/window/Test.json
+20
-0
graphic/crossplatform/window/signature/openharmony_sx.p7b
graphic/crossplatform/window/signature/openharmony_sx.p7b
+0
-0
graphic/crossplatform/window/src/main/ets/TestAbility/TestAbility.ets
...splatform/window/src/main/ets/TestAbility/TestAbility.ets
+65
-0
graphic/crossplatform/window/src/main/ets/TestAbility/pages/Index.ets
...splatform/window/src/main/ets/TestAbility/pages/Index.ets
+49
-0
graphic/crossplatform/window/src/main/ets/TestAbility/pages/Index1.ets
...platform/window/src/main/ets/TestAbility/pages/Index1.ets
+28
-0
graphic/crossplatform/window/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...m/window/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+49
-0
graphic/crossplatform/window/src/main/ets/test/List.test.ets
graphic/crossplatform/window/src/main/ets/test/List.test.ets
+22
-0
graphic/crossplatform/window/src/main/ets/test/Window.test.ets
...ic/crossplatform/window/src/main/ets/test/Window.test.ets
+2259
-0
graphic/crossplatform/window/src/main/ets/test/WindowStage.test.ets
...ossplatform/window/src/main/ets/test/WindowStage.test.ets
+523
-0
graphic/crossplatform/window/src/main/module.json
graphic/crossplatform/window/src/main/module.json
+38
-0
graphic/crossplatform/window/src/main/resources/base/element/color.json
...latform/window/src/main/resources/base/element/color.json
+8
-0
graphic/crossplatform/window/src/main/resources/base/element/string.json
...atform/window/src/main/resources/base/element/string.json
+16
-0
graphic/crossplatform/window/src/main/resources/base/media/icon.png
...ossplatform/window/src/main/resources/base/media/icon.png
+0
-0
graphic/crossplatform/window/src/main/resources/base/profile/test_pages.json
...rm/window/src/main/resources/base/profile/test_pages.json
+6
-0
未找到文件。
graphic/BUILD.gn
浏览文件 @
c9ec06d9
...
...
@@ -16,6 +16,7 @@ group("graphic") {
testonly = true
if (is_standard_system) {
deps = [
"crossplatform/window:ActsCrossplatformWindowTest",
"effectKit:EffectKitTest",
"graphicColorSpace:ActsColorSpaceManagerTest",
"graphicnapidrawingtest:ActsGraphicNapiDrawingTest",
...
...
graphic/crossplatform/window/AppScope/app.json
0 → 100644
浏览文件 @
c9ec06d9
{
"app"
:
{
"bundleName"
:
"ohos.acts.graphic.crossplatform.window"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"minAPIVersion"
:
10
,
"targetAPIVersion"
:
10
,
"car"
:
{
"apiCompatibleVersion"
:
10
,
"singleUser"
:
false
}
}
}
graphic/crossplatform/window/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
c9ec06d9
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"xtsDemo1"
}
]
}
graphic/crossplatform/window/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
c9ec06d9
6.6 KB
graphic/crossplatform/window/BUILD.gn
0 → 100644
浏览文件 @
c9ec06d9
# Copyright (c) 2023 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsCrossplatformWindowTest") {
hap_profile = "src/main/module.json"
deps = [
":windowStage_js_assets",
":windowStage_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsCrossplatformWindowTest"
subsystem_name = "window"
part_name = "window_manager"
}
ohos_app_scope("windowStage_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("windowStage_js_assets") {
source_dir = "src/main/ets"
}
ohos_resources("windowStage_resources") {
sources = [ "src/main/resources" ]
deps = [ ":windowStage_app_profile" ]
hap_profile = "src/main/module.json"
}
graphic/crossplatform/window/Test.json
0 → 100644
浏览文件 @
c9ec06d9
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"shell-timeout"
:
"300000"
,
"bundle-name"
:
"ohos.acts.graphic.crossplatform.window"
,
"module-name"
:
"window"
,
"testcase-timeout"
:
10000
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsCrossplatformWindowTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
graphic/crossplatform/window/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
c9ec06d9
文件已添加
graphic/crossplatform/window/src/main/ets/TestAbility/TestAbility.ets
0 → 100644
浏览文件 @
c9ec06d9
/*
* Copyright (c) 2023 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 UIAbility from '@ohos.app.ability.UIAbility';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import hilog from '@ohos.hilog';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import window from '@ohos.window';
export default class TestAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
globalThis.abilityContext = this.context;
globalThis.windowStage = windowStage;
windowStage.loadContent('TestAbility/pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
graphic/crossplatform/window/src/main/ets/TestAbility/pages/Index.ets
0 → 100644
浏览文件 @
c9ec06d9
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
@Entry
@Component
struct Index {
aboutToAppear() {
hilog.info(0x0000, 'testTag', '%{public}s', '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
graphic/crossplatform/window/src/main/ets/TestAbility/pages/Index1.ets
0 → 100644
浏览文件 @
c9ec06d9
/*
* Copyright (c) 2023 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.
*/
@Entry
@Component
struct Index1 {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World \n pages/Index1!!!')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
graphic/crossplatform/window/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
c9ec06d9
import
hilog
from
'
@ohos.hilog
'
;
import
TestRunner
from
'
@ohos.application.testRunner
'
;
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
async
function
onAbilityCreateCallback
()
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
addAbilityMonitorCallback : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner OnPrepare
'
);
}
async
onRun
()
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun run
'
);
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.TestAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a TestAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
var
debug
=
abilityDelegatorArguments
.
parameters
[
'
-D
'
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : err : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
stdResult
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
exitCode
??
''
);
})
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun end
'
);
}
}
\ No newline at end of file
graphic/crossplatform/window/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
c9ec06d9
/*
* Copyright (c) 2023 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 Window from './Window.test'
import WindowStage from './WindowStage.test'
export default function testsuite() {
Window();
WindowStage();
}
graphic/crossplatform/window/src/main/ets/test/Window.test.ets
0 → 100644
浏览文件 @
c9ec06d9
此差异已折叠。
点击以展开。
graphic/crossplatform/window/src/main/ets/test/WindowStage.test.ets
0 → 100644
浏览文件 @
c9ec06d9
/*
* Copyright (c) 2023 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function WindowStage() {
describe("WindowStage", function () {
let windowStage;
let storage;
const TRUE_FLAG = true;
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
beforeAll(async function () {
console.info("beforeAll case");
windowStage = globalThis.windowStage;
storage = new LocalStorage();
storage.setOrCreate('storageSimpleProp', 121);
});
beforeEach(async function () {
console.info("beforeEach case");
});
afterEach(async function () {
console.info('afterEach case');
});
afterAll(async function () {
console.info("afterAll case");
});
function expectedError(error, caseName, apiName, done, code) {
let msgStr = 'jsunittest ' + caseName + ' ' + apiName + ' failed, err: ';
console.log(msgStr + JSON.stringify(error));
try {
expect(TRUE_FLAG).assertTrue();
expect(error.code === code).assertTrue();
} catch (error) {
console.info(`window.on ${JSON.stringify(error)}`)
}
done();
}
function unexpectedError(error, caseName, apiName, done) {
let msgStr = 'jsunittest ' + caseName + ' ' + apiName + ' failed, err: ';
console.log(msgStr + JSON.stringify(error));
try {
expect().assertFail();
} catch (error) {
console.info(`unexpectedError catch error: ${JSON.stringify(error)}`)
}
done();
}
/**
* @tc.number : TEST_GETMAINWINDOW_PROMISE_001
* @tc.name : testGetMainWindowPromise001
* @tc.desc : Verify the scenario of getMainWindow
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testGetMainWindowPromise001', 0, async function (done) {
let caseName = 'testGetMainWindowPromise001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let mainWin = await windowStage.getMainWindow().catch(err => {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
});
expect(!!mainWin).assertTrue();
console.log(msgStr + 'getMainWindow success');
done();
})
/**
* @tc.number : TEST_GETMAINWINDOW_CB_001
* @tc.name : testGetMainWindowCb001
* @tc.desc : Verify the scenario of getMainWindow
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testGetMainWindowCb001', 0, async function (done) {
let caseName = 'testGetMainWindowCb001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.getMainWindow((err, data) => {
if (err.code) {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
return;
}
try {
expect(!!data).assertTrue();
console.log(msgStr + 'getMainWindow success');
done();
} catch (err) {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
}
})
})
/**
* @tc.number : TEST_GETMAINWINDOWSYNC_001
* @tc.name : testGetMainWindowSync001
* @tc.desc : Verify the scenario of getMainWindow
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testGetMainWindowSync001', 0, async function (done) {
let caseName = 'testGetMainWindowSync001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
let mainWin = windowStage.getMainWindowSync();
expect(!!mainWin).assertTrue();
console.log(msgStr + 'getMainWindow success');
done();
} catch (error) {
console.log(msgStr + 'getMainWindow fail');
done();
}
})
/**
* @tc.number : TEST_CREATESUBWINDOW_PROMISE_001
* @tc.name : testCreateSubWindowPromise001
* @tc.desc : Verify the scenario of creating an auxiliary window
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testCreateSubWindowPromise001', 0, async function (done) {
let caseName = 'testCreateSubWindowPromise001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let subWindow = await windowStage.createSubWindow('testCreateSubWindowPromise001').catch((err) => {
unexpectedError(err, caseName, 'windowStage.createSubWindow', done);
console.log(msgStr + 'windowStage.createSubWindow(createSubWindowTest1)=' + JSON.stringify(err));
});
expect(!!subWindow).assertTrue();
console.log(msgStr + 'windowStage.createSubWindow end subWindow=' + JSON.stringify(subWindow));
console.log(msgStr + 'windowStage.createSubWindow end !!subWindow=' + !!subWindow);
await subWindow.destroyWindow();
done();
})
/**
* @tc.number : TEST_CREATESUBWINDOW_PROMISE_002
* @tc.name : testCreateSubWindowPromise002
* @tc.desc : Verify the scene of entering illegal values to create an auxiliary window
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testCreateSubWindowPromise002', 0, async function (done) {
let caseName = 'testCreateSubWindowPromise002';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
let subWindow = await windowStage.createSubWindow(null).catch((err) => {
expect(false).assertTrue();
console.log(msgStr + 'windowStage.createSubWindow(null) err=' + JSON.stringify(err));
});
console.log(msgStr + 'windowStage.createSubWindow end subWindow=' + JSON.stringify(subWindow));
} catch (err) {
expectedError(err, caseName, 'windowStage.createSubWindow', done, 401);
console.log(msgStr + 'windowStage.createSubWindow catch err=' + JSON.stringify(err));
}
done();
})
/**
* @tc.number : TEST_CREATESUBWINDOW_CB_001
* @tc.name : testCreateSubWindowCb001
* @tc.desc : Verify the scenario of creating an auxiliary window
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testCreateSubWindowCb001', 0, async function (done) {
let caseName = 'testCreateSubWindowCb001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.createSubWindow('testCreateSubWindowCb001', async (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.createSubWindow', done);
} else {
try {
expect(!!data).assertTrue();
console.log(msgStr + ' success');
done();
} catch (err) {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
}
}
})
})
/**
* @tc.number : TEST_CREATESUBWINDOW_CB_002
* @tc.name : testCreateSubWindowCb002
* @tc.desc : Verify the scene of entering illegal values to create an auxiliary window
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testCreateSubWindowCb002', 0, async function (done) {
let caseName = 'testCreateSubWindowCb002';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
windowStage.createSubWindow(null, (err, data) => {
console.log(msgStr + 'windowStage.createSubWindow(null) err=' + JSON.stringify(err));
try {
expect(false).assertTrue();
} catch (error) {
console.info(`windowStage.createSubWindow catch error: ${JSON.stringify(error)}`)
}
done();
});
} catch (err) {
try {
expect(err.code === 401).assertTrue();
} catch (error) {
console.info(`tempWnd.show catch error: ${JSON.stringify(error)}`)
}
done();
console.log(msgStr + 'windowStage.createSubWindow(null) catch err=' + JSON.stringify(err));
}
})
/**
* @tc.number : TEST_GETSUBWINDOW_PROMISE_001
* @tc.name : testGetSubWindowPromise001
* @tc.desc : Verify the scene of obtaining all auxiliary sub windows
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testGetSubWindowPromise001', 0, async function (done) {
let caseName = 'testGetSubWindowPromise001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let subWindow = await windowStage.getSubWindow().catch((err) => {
unexpectedError(err, caseName, 'windowStage.getSubWindow', done);
console.log(msgStr + 'windowStage.getSubWindow(null) err=' + JSON.stringify(err));
});
expect(!!subWindow).assertTrue();
console.log(msgStr + 'windowStage.getSubWindow end subWindow=' + JSON.stringify(subWindow));
done();
})
/**
* @tc.number : TEST_GETSUBWINDOW_CB_001
* @tc.name : testGetSubWindowCb001
* @tc.desc : Verify the scene of obtaining all auxiliary sub windows
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testGetSubWindowCb001', 0, async function (done) {
let caseName = 'testGetSubWindowCb001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.getSubWindow((err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.getSubWindow', done);
console.log(msgStr + 'windowStage.getSubWindow(null) err=' + JSON.stringify(err));
} else {
try {
expect(!!data).assertTrue();
} catch (error) {
console.info(`windowStage.getSubWindow catch error: ${JSON.stringify(error)}`)
}
done();
console.log(msgStr + 'windowStage.getSubWindow end data=' + JSON.stringify(data));
}
})
})
/**
* @tc.number : TEST_LOADCONTENT_PROMISE_001
* @tc.name : testLoadContentPromise001
* @tc.desc : Verify the scenario of loading an existing page
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentPromise001', 0, async function (done) {
let caseName = 'testLoadContentPromise001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index1').then(async () => {
expect(true).assertTrue();
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index')
await sleep(500);
console.log(msgStr + 'tempWnd.loadContent success');
done();
}).catch((err) => {
unexpectedError(err, caseName, 'windowStage loadContent', done);
});
done();
})
/**
* @tc.number : TEST_LOADCONTENT_PROMISE_002
* @tc.name : testLoadContentPromise002
* @tc.desc : Verify the scenario of loading an null page
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentPromise002', 0, async function (done) {
let caseName = 'testLoadContentPromise002';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
let load = await windowStage.loadContent(null).catch((err) => {
expect(false).assertTrue();
console.log(msgStr + 'windowStage loadContent null' + JSON.stringify(err));
});
console.log(msgStr + 'windowStage loadContent end load=' + JSON.stringify(load));
}
catch (err) {
console.log(msgStr + 'windowStage loadContent catch err=' + JSON.stringify(err));
expectedError(err, caseName, 'tempWnd.loadContent', done, 401);
}
done();
})
/**
* @tc.number : TEST_LOADCONTENT_PROMISE_003
* @tc.name : testLoadContentPromise003
* @tc.desc : Verify the scenario of loading an null page with storage
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentPromise003', 0, async function (done) {
let caseName = 'testLoadContentPromise003';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
let load = await windowStage.loadContent(null, storage).catch((err) => {
expect(false).assertTrue();
console.log(msgStr + 'windowStage loadContent null' + JSON.stringify(err));
});
console.log(msgStr + 'windowStage loadContent end load=' + JSON.stringify(load));
}
catch (err) {
console.log(msgStr + 'windowStage loadContent catch err=' + JSON.stringify(err));
expectedError(err, caseName, 'windowStage loadContent', done, 401);
}
done();
})
/**
* @tc.number : TEST_LOADCONTENT_PROMISE_004
* @tc.name : testLoadContentPromise004
* @tc.desc : Verify the scenario of loading an page and storage of null
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentPromise004', 0, async function (done) {
let caseName = 'testLoadContentPromise004';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index1', null).then(async () => {
expect(true).assertTrue();
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index')
await sleep(500);
console.log(msgStr + 'tempWnd.loadContent success');
done();
}).catch((err) => {
unexpectedError(err, caseName, 'windowStage loadContent', done);
});
done();
})
/**
* @tc.number : TEST_LOADCONTENT_CB_001
* @tc.name : testLoadContentCb001
* @tc.desc : Verify the scenario of loading an existing page
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentCb001', 0, async function (done) {
let caseName = 'testLoadContentCb001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
await sleep(500);
windowStage.loadContent('TestAbility/pages/Index1', async (err) => {
if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.loadContent', done);
} else {
try {
expect(true).assertTrue();
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index')
await sleep(500);
console.log(msgStr + 'tempWnd.loadContent success');
done();
} catch (err) {
unexpectedError(err, caseName, 'windowStage.loadContent', done);
}
}
})
})
/**
* @tc.number : TEST_LOADCONTENT_CB_002
* @tc.name : testLoadContentCb002
* @tc.desc : Verify the scenario of loading an null page
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentCb002', 0, async function (done) {
let caseName = 'testLoadContentCb002';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
windowStage.loadContent(null, (err) => {
console.log(msgStr + 'windowStage loadContent null' + JSON.stringify(err));
try {
expect(false).assertTrue();
} catch (error) {
console.info(`windowStage.loadContent catch error: ${JSON.stringify(error)}`)
}
done();
});
} catch (err) {
console.log(msgStr + 'windowStage loadContent null catch err' + JSON.stringify(err));
try {
expect(err.code == 401).assertTrue();
} catch (error) {
console.info(`windowStage.loadContent catch error: ${JSON.stringify(error)}`)
}
done();
}
console.log(msgStr + 'end');
})
/**
* @tc.number : TEST_LOADCONTENT_STORAGE_CB_001
* @tc.name : testLoadContentStorageCb001
* @tc.desc : Verify the scenario of loading an page and storage
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentStorageCb001', 0, async function (done) {
let caseName = 'testLoadContentStorageCb001';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.loadContent('TestAbility/pages/Index1', storage, async (err) => {
if (err && err.code) {
unexpectedError(err, caseName, 'windowStage.loadContent', done);
} else {
try {
expect(true).assertTrue();
await sleep(500);
await windowStage.loadContent('TestAbility/pages/Index')
await sleep(500);
console.log(msgStr + 'tempWnd.loadContent success');
done();
} catch (err) {
unexpectedError(err, caseName, 'windowStage.loadContent', done);
}
}
})
})
/**
* @tc.number : TEST_LOADCONTENT_STORAGE_CB_002
* @tc.name : testLoadContentStorageCb002
* @tc.desc : Verify the scenario of loading an null page with storage
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testLoadContentStorageCb002', 0, async function (done) {
let caseName = 'testLoadContentStorageCb002';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
try {
windowStage.loadContent(null, storage, (err) => {
console.log(msgStr + 'windowStage loadContent null ' + JSON.stringify(err));
try {
expect(false).assertTrue();
} catch (error) {
console.info(`windowStage.loadContent catch error: ${JSON.stringify(error)}`)
}
done();
});
} catch (err) {
console.log(msgStr + 'windowStage loadContent null catch err ' + JSON.stringify(err));
try {
expect(err.code === 401).assertTrue();
} catch (error) {
console.info(`windowStage.loadContent catch error: ${JSON.stringify(error)}`)
}
done();
}
})
})
}
graphic/crossplatform/window/src/main/module.json
0 → 100644
浏览文件 @
c9ec06d9
{
"module"
:
{
"name"
:
"window"
,
"type"
:
"feature"
,
"description"
:
"$string:module_test_desc"
,
"mainElement"
:
"TestAbility"
,
"deviceTypes"
:
[
"phone"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:test_pages"
,
"abilities"
:
[
{
"name"
:
"TestAbility"
,
"srcEntry"
:
"./ets/TestAbility/TestAbility.ets"
,
"description"
:
"$string:TestAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:TestAbility_label"
,
"exported"
:
true
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:
[
"entity.system.home"
]
}
]
}
],
"requestPermissions"
:
[
]
}
}
\ No newline at end of file
graphic/crossplatform/window/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
c9ec06d9
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
graphic/crossplatform/window/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
c9ec06d9
{
"string"
:
[
{
"name"
:
"module_test_desc"
,
"value"
:
"test ability description"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
}
]
}
\ No newline at end of file
graphic/crossplatform/window/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
c9ec06d9
6.6 KB
graphic/crossplatform/window/src/main/resources/base/profile/test_pages.json
0 → 100644
浏览文件 @
c9ec06d9
{
"src"
:
[
"TestAbility/pages/Index"
,
"TestAbility/pages/Index1"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录