Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2707fd47
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看板
未验证
提交
2707fd47
编写于
3月 25, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 25, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8193 优化用例
Merge pull request !8193 from 姚翠/master
上级
9d562201
878bba9f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
208 addition
and
222 deletion
+208
-222
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
.../main/ets/test/displayAndWindowRefactorInterface.test.ets
+3
-10
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+18
-23
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+187
-189
未找到文件。
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
浏览文件 @
2707fd47
...
...
@@ -35,14 +35,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
var
systemWindowTypeDicArr
=
[];
var
systemWindowTypeDic
=
{
'TYPE_SYSTEM_ALERT'
:
1
,
'TYPE_INPUT_METHOD'
:
2
,
'TYPE_STATUS_BAR'
:
3
,
'TYPE_PANEL'
:
4
,
'TYPE_KEYGUARD'
:
5
,
'TYPE_VOLUME_OVERLAY'
:
6
,
'TYPE_NAVIGATION_BAR'
:
7
,
'TYPE_FLOAT'
:
8
,
// 'TYPE_FLOAT_CAMERA': 9
}
var
windowLayoutModeArr
=
[];
var
windowLayoutModeDic
=
{
...
...
@@ -2051,7 +2044,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
try
{
let
isLayoutFullScreen
=
false
;
await
wnd
.
setWindowLayoutFullScreen
(
isLayoutFullScreen
)
.
then
(()
=>
{
console
.
info
(
msgStr
+
'Succeeded in setting the window layout to full-screen mode.'
);
console
.
info
(
msgStr
+
'Succeeded in setting the window
not
layout to full-screen mode.'
);
try
{
let
propData
=
wnd
.
getWindowProperties
()
console
.
info
(
msgStr
+
'wnd.getWindowProperties propData: '
+
JSON
.
stringify
(
propData
));
...
...
@@ -2141,7 +2134,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
try
{
wnd
.
setWindowLayoutFullScreen
(
isLayoutFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
msgStr
+
'err Failed to set the window layout to full-screen mode. Cause:'
+
JSON
.
stringify
(
err
));
console
.
error
(
msgStr
+
'err Failed to set the window
not
layout to full-screen mode. Cause:'
+
JSON
.
stringify
(
err
));
try
{
expect
()
.
assertFail
();
}
catch
(
error
)
{
...
...
@@ -2150,7 +2143,7 @@ export default function displayAndWindowRefactorInterfaceTest(context, windowSta
done
();
return
;
}
console
.
info
(
msgStr
+
'Succeeded in setting the window layout to full-screen mode.'
);
console
.
info
(
msgStr
+
'Succeeded in setting the window
not
layout to full-screen mode.'
);
try
{
let
propData
=
wnd
.
getWindowProperties
()
console
.
log
(
msgStr
+
JSON
.
stringify
(
propData
));
...
...
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
2707fd47
...
...
@@ -40,14 +40,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
var
systemWindowTypeArr
=
[];
var
systemWindowTypeDic
=
{
'TYPE_SYSTEM_ALERT'
:
1
,
'TYPE_INPUT_METHOD'
:
2
,
'TYPE_STATUS_BAR'
:
3
,
'TYPE_PANEL'
:
4
,
'TYPE_KEYGUARD'
:
5
,
'TYPE_VOLUME_OVERLAY'
:
6
,
'TYPE_NAVIGATION_BAR'
:
7
,
'TYPE_FLOAT'
:
8
,
'TYPE_FLOAT_CAMERA'
:
9
}
var
windowLayoutModeArr
=
[];
var
windowLayoutModeDic
=
{
...
...
@@ -1591,10 +1584,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let
caseName
=
'loadContentTest9'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
windowStage
.
loadContent
(
'
pages/index/index.ets
'
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
MainAbility/pages/second/second
'
,
(
err
,
data
)
=>
{
if
(
err
&&
err
.
code
)
{
unexpectedError
(
err
,
caseName
,
'windowStage.loadContent'
,
done
);
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent MainAbility/pages/second/second
'
+
JSON
.
stringify
(
err
));
}
else
{
try
{
expect
(
!
data
)
.
assertTrue
();
...
...
@@ -1618,7 +1611,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
try
{
windowStage
.
loadContent
(
null
,
(
err
,
data
)
=>
{
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent null
'
+
JSON
.
stringify
(
err
));
try
{
expect
(
false
)
.
assertTrue
();
}
catch
(
error
)
{
...
...
@@ -1627,7 +1620,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
done
();
});
}
catch
(
err
)
{
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
catch err'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent null
catch err'
+
JSON
.
stringify
(
err
));
try
{
expect
(
err
.
code
==
401
)
.
assertTrue
();
}
catch
(
error
)
{
...
...
@@ -1647,10 +1640,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
windowStage
.
loadContent
(
'
pages/index/index.ets
'
,
abilityStorage
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
MainAbility/pages/second/second
'
,
abilityStorage
,
(
err
,
data
)
=>
{
if
(
err
&&
err
.
code
)
{
unexpectedError
(
err
,
caseName
,
'windowStage.loadContent'
,
done
);
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent MainAbility/pages/second/second
'
+
JSON
.
stringify
(
err
));
}
else
{
try
{
expect
(
!
data
)
.
assertTrue
();
...
...
@@ -1674,7 +1667,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
try
{
windowStage
.
loadContent
(
null
,
abilityStorage
,
(
err
,
data
)
=>
{
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent null
'
+
JSON
.
stringify
(
err
));
try
{
expect
(
false
)
.
assertTrue
();
}
catch
(
error
)
{
...
...
@@ -1683,7 +1676,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
done
();
});
}
catch
(
err
)
{
console
.
log
(
msgStr
+
'windowStage
.loadContent(pages/index/index.ets)
catch err '
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage
loadContent null
catch err '
+
JSON
.
stringify
(
err
));
try
{
expect
(
err
.
code
===
401
)
.
assertTrue
();
}
catch
(
error
)
{
...
...
@@ -2037,6 +2030,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
expect
()
.
assertFail
();
done
();
});
await
sleep
(
3000
)
console
.
info
(
msgStr
+
'Succeeded in setting window orientation. orientation: '
+
orientation
+
"step: "
+
i
);
}
done
()
...
...
@@ -2102,6 +2096,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'windowStage.getMainWindow'
+
JSON
.
stringify
(
mainWin
));
expect
(
!!
mainWin
)
.
assertTrue
();
await
sleep
(
2000
)
mainWin
.
snapshot
((
err
,
data
)
=>
{
if
(
err
&&
err
.
code
)
{
console
.
log
(
msgStr
+
'snapshot err.code:'
+
JSON
.
stringify
(
err
.
code
));
...
...
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
2707fd47
...
...
@@ -37,14 +37,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
var
systemWindowTypeDicArr
=
[];
var
systemWindowTypeDic
=
{
'TYPE_SYSTEM_ALERT'
:
1
,
'TYPE_INPUT_METHOD': 2,
'TYPE_STATUS_BAR': 3,
'TYPE_PANEL': 4,
'TYPE_KEYGUARD': 5,
'TYPE_VOLUME_OVERLAY': 6,
'TYPE_NAVIGATION_BAR': 7,
'TYPE_FLOAT'
:
8
,
'TYPE_FLOAT_CAMERA': 9
}
var
windowLayoutModeArr
=
[];
var
windowLayoutModeDic
=
{
...
...
@@ -107,12 +100,15 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
}
function sleep(time) {
return new Promise(resolve => {
setTimeout(() => {
async
function
sleep
(
time
)
{
let
timeoutId
=
null
;
let
promise
=
new
Promise
(
resolve
=>
{
timeoutId
=
setTimeout
(()
=>
{
resolve
(
'sleep finished'
);
},
time
);
})
let
result
=
await
promise
;
clearTimeout
(
timeoutId
)
}
/**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_001
...
...
@@ -172,7 +168,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let
caseName
=
'listenerTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
wndId
=
'listenerTest2'
;
let baseType =
2
;
let
baseType
=
ohosWindow
.
WindowType
.
TYPE_SYSTEM_ALERT
;
let
changedModel
=
102
;
let
baseValue
=
100
;
let
resizeValue
=
200
;
...
...
@@ -281,7 +277,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let
caseName
=
'listenerTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
wndId
=
'listenerTest4'
;
let baseType =
2
;
let
baseType
=
ohosWindow
.
WindowType
.
TYPE_SYSTEM_ALERT
;
let
changedModel
=
102
;
let
listenerOffFlag
=
false
;
listenerData
.
on
=
true
;
...
...
@@ -1185,9 +1181,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let
caseName
=
'loadContentTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let load3 = await windowStage.loadContent('
pages/index/index.ets
').catch((err) => {
unexpectedError(err, caseName, '
tempWnd.
loadContent', done);
console.log(msgStr + '
tempWnd.loadContent(pages/index/index.ets)
' + JSON.stringify(err));
let
load3
=
await
windowStage
.
loadContent
(
'
MainAbility/pages/second/second
'
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'
windowStage
loadContent'
,
done
);
console
.
log
(
msgStr
+
'
windowStage loadContent MainAbility/pages/second/second
'
+
JSON
.
stringify
(
err
));
});
expect
(
!
load3
)
.
assertTrue
();
console
.
log
(
msgStr
+
'tempWnd.loadContent end load='
+
JSON
.
stringify
(
load3
));
...
...
@@ -1205,12 +1201,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
try
{
let
load4
=
await
windowStage
.
loadContent
(
null
)
.
catch
((
err
)
=>
{
expect
(
false
)
.
assertTrue
();
console.log(msgStr + '
tempWnd.loadContent(pages/index/index.ets)
' + JSON.stringify(err));
console
.
log
(
msgStr
+
'
windowStage loadContent null
'
+
JSON
.
stringify
(
err
));
});
console.log(msgStr + '
tempWnd.
loadContent end load5=' + JSON.stringify(load4));
console
.
log
(
msgStr
+
'
windowStage
loadContent end load5='
+
JSON
.
stringify
(
load4
));
}
catch
(
err
)
{
console.log(msgStr + '
tempWnd.
loadContent catch err=' + JSON.stringify(err));
console
.
log
(
msgStr
+
'
windowStage
loadContent catch err='
+
JSON
.
stringify
(
err
));
expectedError
(
err
.
code
,
caseName
,
'tempWnd.loadContent'
,
done
,
401
);
}
done
();
...
...
@@ -1227,13 +1223,13 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
try
{
let
load5
=
await
windowStage
.
loadContent
(
null
,
abilityStorage
)
.
catch
((
err
)
=>
{
expect
(
false
)
.
assertTrue
();
console.log(msgStr + '
tempWnd.loadContent(pages/index/index.ets)
' + JSON.stringify(err));
console
.
log
(
msgStr
+
'
windowStage loadContent null
'
+
JSON
.
stringify
(
err
));
});
console.log(msgStr + '
tempWnd.
loadContent end load5=' + JSON.stringify(load5));
console
.
log
(
msgStr
+
'
windowStage
loadContent end load5='
+
JSON
.
stringify
(
load5
));
}
catch
(
err
)
{
console.log(msgStr + '
tempWnd.
loadContent catch err=' + JSON.stringify(err));
expectedError(err.code, caseName, '
tempWnd.
loadContent', done, 401);
console
.
log
(
msgStr
+
'
windowStage
loadContent catch err='
+
JSON
.
stringify
(
err
));
expectedError
(
err
.
code
,
caseName
,
'
windowStage
loadContent'
,
done
,
401
);
}
done
();
})
...
...
@@ -1246,9 +1242,9 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
let
caseName
=
'loadContentTest6'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let load6 = await windowStage.loadContent('
pages/index/index.ets
', null).catch((err) => {
unexpectedError(err, caseName, '
tempWnd.
loadContent', done);
console.log(msgStr + '
tempWnd.loadContent(pages/index/index.ets)
' + JSON.stringify(err));
let
load6
=
await
windowStage
.
loadContent
(
'
MainAbility/pages/second/second
'
,
null
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'
windowStage
loadContent'
,
done
);
console
.
log
(
msgStr
+
'
windowStage loadContent MainAbility/pages/second/second
'
+
JSON
.
stringify
(
err
));
});
expect
(
!
load6
)
.
assertTrue
();
done
();
...
...
@@ -1429,6 +1425,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
.
catch
(
err
=>
{
console
.
log
(
msgStr
+
'window.setPreferredOrientation failed set error:'
+
orientation
);
});
await
sleep
(
3000
)
}
})
/**
...
...
@@ -1472,6 +1469,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
console
.
log
(
msgStr
+
'windowStage.getMainWindow'
+
JSON
.
stringify
(
mainWin
));
expect
(
!!
mainWin
)
.
assertTrue
();
await
sleep
(
2000
)
let
snapshotData
=
await
mainWin
.
snapshot
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'mainWin.snapshot'
,
done
);
console
.
log
(
msgStr
+
'snapshot err.code:'
+
JSON
.
stringify
(
err
.
code
));
...
...
@@ -1726,10 +1724,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
})
/**
* @tc.number WINDOWEVENTTYPE_JSAPI_001
* @tc.name Test windowEventType_Test_001.
* @tc.desc Test the enumeration value of WindowEventType
*/
* @tc.number WINDOWEVENTTYPE_JSAPI_001
* @tc.name Test windowEventType_Test_001.
* @tc.desc Test the enumeration value of WindowEventType
*/
it
(
'windowEventType_Test_001'
,
0
,
async
function
(
done
)
{
let
caseName
=
'windowEventType_Test_001'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录