Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fdfc1b36
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看板
提交
fdfc1b36
编写于
10月 25, 2022
作者:
Y
yaocui_moring
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Signed-off-by:
N
yaocui_moring
<
yaocui2@h-partners.com
>
上级
99d7e0e9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
105 addition
and
31 deletion
+105
-31
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
.../main/ets/test/displayAndWindowRefactorInterface.test.ets
+105
-31
未找到文件。
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
浏览文件 @
fdfc1b36
...
...
@@ -34,7 +34,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
var systemWindowValueArr = [];
var systemWindowTypeArr = [];
var systemWindowTypeDicArr = [];
var windowModeArr=['UNDEFINED','FULLSCREEN','PRIMARY','SECONDARY','FLOATING']
var systemWindowTypeDic = {
'TYPE_SYSTEM_ALERT': 1,
'TYPE_INPUT_METHOD': 2,
...
...
@@ -197,7 +196,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
let tempType = Number(ohosWindow.WindowType[systemWindowTypeDicArr[i]])
let windId = 'createWindowTest1' + i;
console.log(msgStr + 'ohosWindow.createWindow: ' + tempType + ' start');
let windowConfig = {name: windId, windowType: tempType, ctx: context};
let windowConfig = {name: windId, windowType: tempType, ctx: context
, displayId: -1, parentId: -1
};
try{
let tempWnd = await ohosWindow.createWindow(windowConfig).catch((err) => {
console.log(msgStr + 'ohosWindow.createWindow ' + tempType + 'catched, err: ' + JSON.stringify(err));
...
...
@@ -214,15 +213,15 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
})
/**
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
4
* @tc.name Test createWindowTest
4
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
2
* @tc.name Test createWindowTest
2
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createWindowTest
4
', 0, async function (done) {
let caseName = 'createWindowTest
4
';
it('createWindowTest
2
', 0, async function (done) {
let caseName = 'createWindowTest
2
';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'createWindowSameidsTest
4
'
let windowId = 'createWindowSameidsTest
2
'
let windowConfig = {name: windowId, windowType: 1, ctx: context};
try{
let ohosData = await ohosWindow.createWindow(windowConfig).catch((err) => {
...
...
@@ -246,12 +245,12 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
})
/**
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
5
* @tc.name Test createWindowTest
5
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
4
* @tc.name Test createWindowTest
4
* @tc.desc Verify the scenario of creating the application type window
*/
it('createWindowTest
5
', 0, done => {
let caseName = 'createWindowTest
5
';
it('createWindowTest
4
', 0, done => {
let caseName = 'createWindowTest
4
';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
let loopCount = appWindowTypeArr.length;
...
...
@@ -259,7 +258,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
for (let i = 0; i < loopCount; i++) {
sleep(500)
let tempType = ohosWindow.WindowType.TYPE_APP;
let windId = 'createWindowTest
5
' + i;
let windId = 'createWindowTest
4
' + i;
console.log(msgStr + 'ohosWindow.createWindow ' + tempType + ' start');
let windowConfig = {name: windId, windowType: tempType, ctx: context};
try{
...
...
@@ -280,18 +279,18 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
done();
})
/**
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
6
* @tc.name Test createWindowTest
6
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
5
* @tc.name Test createWindowTest
5
* @tc.desc Verify the scenario of creating the system type window
*/
it('createWindowTest
6
', 0, done => {
let caseName = 'createWindowTest
6
';
it('createWindowTest
5
', 0, done => {
let caseName = 'createWindowTest
5
';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let loopCount = systemWindowTypeArr.length;
console.log('jsunittest loopCount: ' + loopCount);
let tempType = ohosWindow.WindowType.TYPE_SYSTEM_ALERT;
let windId = 'createWindowTest
6
';
let windId = 'createWindowTest
5
';
console.log(msgStr + 'ohosWindow.createWindow ' + tempType + ' start');
let windowConfig = {name: windId, windowType: tempType, ctx: context};
try{
...
...
@@ -317,15 +316,15 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
};
})
/**
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
8
* @tc.name Test createWindowTest
8
* @tc.number SUB_WINDOW_CREATEWINDOW_JSAPI_00
6
* @tc.name Test createWindowTest
6
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createWindowTest
8
', 0, done => {
let caseName = 'createWindowTest
8
';
it('createWindowTest
6
', 0, done => {
let caseName = 'createWindowTest
6
';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let windowId = 'createWindowSameidTest
8
'
let windowId = 'createWindowSameidTest
6
'
let winsowConfig = {name: windowId, windowType:1, ctx: context};
try{
ohosWindow.createWindow(winsowConfig, (err, data) => {
...
...
@@ -397,10 +396,6 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
let caseName = 'getWindowAvoidAreaTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
try{
// let tempWnd = await ohosWindow.getLastWindow(context).catch((err)=>{
// console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
// unexpectedError(err, caseName, 'ohosWindow.getLastWindow', done);
// })
let tempWnd = windowStage.getMainWindowSync();
expect(tempWnd != null).assertTrue();
try {
...
...
@@ -521,7 +516,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
};
})
/**
* @tc.number SUB_WINDOW_
FIND
WINDOW_JSAPI_001
* @tc.number SUB_WINDOW_
GETLAST
WINDOW_JSAPI_001
* @tc.name Test getLastWindowTest1
* @tc.desc Get the final show window
*/
...
...
@@ -1661,6 +1656,8 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
* @tc.desc Test window.setWindowMode API function test.
*/
it('setWindowModeTest1', 0, function (done) {
//['UNDEFINED','FULLSCREEN','PRIMARY','SECONDARY','FLOATING']
let windowModeArr=['FULLSCREEN','PRIMARY','SECONDARY','FLOATING']
let caseName = 'setWindowModeTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
let sumCount=0
...
...
@@ -1678,11 +1675,10 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
sumCount++
console.info(msgStr +'Succeeded in setting the window mode. count: '+sumCount);
console.info(msgStr +'Succeeded in setting the window mode. loopCount.length: '+loopCount.length);
if(sumCount==loopCount.length
-1
) done();
if(sumCount==loopCount.length) done();
}).catch((err)=>{
console.log(msgStr +'currentType: '+tempType)
console.error(msgStr +'Failed to set the window mode. Cause: ' + JSON.stringify(err));
if(tempType == 1) return;
unexpectedError(err, caseName, 'tempWnd.setWindowType', done);
});
} catch (exception) {
...
...
@@ -1699,6 +1695,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
* @tc.desc Verify the scenario where the normal window mode is set
*/
it('setWindowModeTest2', 0, function (done) {
let windowModeArr=['FULLSCREEN','PRIMARY','SECONDARY','FLOATING']
let caseName = 'setWindowModeTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
let sumCount=0
...
...
@@ -1716,13 +1713,90 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
if (err && err.code) {
console.log(msgStr +'currentType: '+tempType)
console.error(msgStr +'Failed to set the window mode. Cause: ' + JSON.stringify(err));
if(tempType == 1) return;
unexpectedError(err, caseName, 'tempWnd.setWindowType', done);
} else {
sumCount++
console.info(msgStr +'Succeeded in setting the window mode. count: '+sumCount);
console.info(msgStr +'Succeeded in setting the window mode. loopCount.length: '+loopCount.length);
if(sumCount==loopCount.length-1) done();
if(sumCount==loopCount.length) done();
}
})
} catch (exception) {
console.error(msgStr +'try catch Failed to set the window mode. Cause: ' + JSON.stringify(exception));
};
}
} catch (exception) {
console.error(msgStr +'try catch Failed to create the window. Cause: ' + JSON.stringify(exception));
};
})
/**
* @tc.number SUB_WINDOW_SETWINDOWMODE_JSAPI_003
* @tc.name Test setWindowModeTest3
* @tc.desc Test window.setWindowMode API function test.
*/
it('setWindowModeTest3', 0, function (done) {
let windowModeArr=['UNDEFINED']
let caseName = 'setWindowModeTest3';
let msgStr = 'jsunittest ' + caseName + ' ';
let sumCount=0
try {
let tempWnd = windowStage.getMainWindowSync();
expect(!!tempWnd).assertTrue();
let loopCount = windowModeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount))
for (let i = 0; i < loopCount.length; i++) {
sleep(500)
let tempType = ohosWindow.WindowMode[loopCount[i]];
console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start');
try {
tempWnd.setWindowMode(tempType).then(()=> {
sumCount++
console.info(msgStr +'Succeeded in setting the window mode. count: '+sumCount);
console.info(msgStr +'Succeeded in setting the window mode. loopCount.length: '+loopCount.length);
}).catch((err)=>{
console.log(msgStr +'currentType: '+tempType)
console.error(msgStr +'Failed to set the window mode. Cause: ' + JSON.stringify(err));
expect(err.code==401).assertTrue();
done();
});
} catch (exception) {
console.error(msgStr +'try catch Failed to set the window mode. Cause: ' + JSON.stringify(exception));
};
}
} catch (exception) {
console.error('try catch Failed to obtain the getMainWindowSync. Cause: ' + JSON.stringify(exception));
};
})
/**
* @tc.number SUB_WINDOW_SETWINDOWMODE_JSAPI_004
* @tc.name Test setWindowModeTest4
* @tc.desc Verify the scenario where the normal window mode is set
*/
it('setWindowModeTest4', 0, function (done) {
let windowModeArr=['UNDEFINED']
let caseName = 'setWindowModeTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
let sumCount=0
try{
let wnd = windowStage.getMainWindowSync();
expect(!!wnd).assertTrue();
let loopCount = windowModeArr;
console.log(msgStr + 'ohosWindow.windowType' + JSON.stringify(loopCount))
for (let i = 0; i < loopCount.length; i++) {
sleep(500)
let tempType = ohosWindow.WindowMode[loopCount[i]];
console.log(msgStr + 'tempWnd.setWindowMode ' + tempType + ' start');
try{
wnd.setWindowMode(tempType, (err, data) => {
if (err && err.code) {
console.log(msgStr +'currentType: '+tempType)
console.error(msgStr +'Failed to set the window mode. Cause: ' + JSON.stringify(err));
expect(err.code==401).assertTrue();
done();
} else {
sumCount++
console.info(msgStr +'Succeeded in setting the window mode. count: '+sumCount);
console.info(msgStr +'Succeeded in setting the window mode. loopCount.length: '+loopCount.length);
}
})
} catch (exception) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录