Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
98585e35
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看板
提交
98585e35
编写于
3月 24, 2023
作者:
Y
yaocui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix snapshot case
Signed-off-by:
N
yaocui
<
yaocui2@h-partners.com
>
上级
7e10cc31
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
255 addition
and
294 deletion
+255
-294
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
.../main/ets/test/displayAndWindowRefactorInterface.test.ets
+3
-3
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+50
-115
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+202
-176
未找到文件。
graphic/windowStage/entry/src/main/ets/test/displayAndWindowRefactorInterface.test.ets
浏览文件 @
98585e35
...
...
@@ -2051,7 +2051,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 +2141,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 +2150,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
浏览文件 @
98585e35
...
...
@@ -130,105 +130,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let
result
=
await
promise
;
clearTimeout
(
timeoutId
)
}
/**
* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_001
* @tc.name Test snapshotTest1
* @tc.desc Scenario of screenshot of verification window
*/
it
(
'snapshotTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'snapshotTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
baseWndType
=
1
;
let
windowId
=
'snapshotTest1'
;
let
tempWnd
=
null
tempWnd
=
await
ohosWindow
.
create
(
context
,
windowId
,
baseWndType
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.create'
,
done
);
})
console
.
log
(
msgStr
+
'ohosWindow.create '
+
baseWndType
+
' ,tempWnd: '
+
tempWnd
);
expect
(
!!
tempWnd
)
.
assertTrue
();
await
tempWnd
.
show
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.show'
,
done
);
});
console
.
log
(
msgStr
+
'tempWnd.show success'
);
await
sleep
(
5000
);
let
snapshotData
=
await
tempWnd
.
snapshot
()
.
catch
((
err
)
=>
{
tempWnd
.
destroyWindow
();
unexpectedError
(
err
,
caseName
,
'mainWin.snapshot'
,
done
);
console
.
log
(
msgStr
+
'snapshot err.code:'
+
JSON
.
stringify
(
err
.
code
));
})
expect
(
!!
snapshotData
)
.
assertTrue
();
await
tempWnd
.
destroyWindow
();
done
();
})
/**
* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_002
* @tc.name Test snapshotTest2
* @tc.desc Scenario of screenshot of verification window
*/
it
(
'snapshotTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'snapshotTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
tempType
=
ohosWindow
.
WindowType
.
TYPE_SYSTEM_ALERT
;
function
createWin
(
windId
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
ohosWindow
.
create
(
context
,
windId
,
tempType
,
(
err
,
data
)
=>
{
if
(
err
&&
err
.
code
)
{
reject
(
null
)
}
else
{
console
.
log
(
msgStr
+
'ohosWindow.create '
+
tempType
+
' wnd: '
+
tempWnd
);
resolve
(
data
)
}
})
})
}
function
show
(
tempWnd
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
tempWnd
.
show
((
err
)
=>
{
if
(
err
&&
err
.
code
)
{
reject
(
null
)
}
else
{
console
.
log
(
msgStr
+
'mainWnd.show success'
);
resolve
(
true
)
}
})
})
}
let
windId
=
'snapshotTest2'
;
let
tempWnd
;
tempWnd
=
await
createWin
(
windId
)
.
catch
(
err
=>
{
console
.
info
(
msgStr
+
`ohosWindow.create catch error: ${JSON.stringify(err)}`
)
expect
()
.
assertFail
();
done
();
})
console
.
log
(
msgStr
+
'windowStage.getMainWindow'
+
JSON
.
stringify
(
tempWnd
));
expect
(
!!
tempWnd
)
.
assertTrue
();
await
show
(
tempWnd
)
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to show the window. Cause: '
+
JSON
.
stringify
(
err
));
expect
()
.
assertFail
()
done
();
});
console
.
log
(
msgStr
+
'tempWnd.show success'
);
await
sleep
(
5000
);
tempWnd
.
snapshot
(
async
(
err
,
data
)
=>
{
if
(
err
&&
err
.
code
)
{
console
.
log
(
msgStr
+
'snapshot err.code:'
+
JSON
.
stringify
(
err
.
code
));
try
{
expect
()
.
assertFail
();
}
catch
(
error
)
{
console
.
info
(
`expected catch error: ${JSON.stringify(error)}`
)
}
await
tempWnd
.
destroyWindow
();
done
();
return
;
}
await
tempWnd
.
destroyWindow
();
done
();
console
.
log
(
msgStr
+
'snapshot success data:'
+
JSON
.
stringify
(
data
));
})
})
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_006
* @tc.name Test setSystemBarEnableTest6
...
...
@@ -1690,10 +1591,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
();
...
...
@@ -1717,7 +1618,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
)
{
...
...
@@ -1726,7 +1627,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
)
{
...
...
@@ -1746,10 +1647,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
();
...
...
@@ -1773,7 +1674,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
)
{
...
...
@@ -1782,7 +1683,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
)
{
...
...
@@ -2136,6 +2037,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
()
...
...
@@ -2185,6 +2087,39 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'done '
);
done
();
})
/**
* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_002
* @tc.name Test snapshotTest2
* @tc.desc Scenario of screenshot of verification window
*/
it
(
'snapshotTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'snapshotTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
mainWin
=
null
mainWin
=
await
windowStage
.
getMainWindow
()
.
catch
(
err
=>
{
unexpectedError
(
err
,
caseName
,
'windowStage.getMainWindow'
,
done
);
});
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
));
try
{
expect
()
.
assertFail
();
}
catch
(
error
)
{
console
.
info
(
`expected catch error: ${JSON.stringify(error)}`
)
}
done
();
return
;
}
done
();
console
.
log
(
msgStr
+
'snapshot success data:'
+
JSON
.
stringify
(
data
));
})
})
/**
* @tc.number SUB_WINDOW_DIALOGTARGETTOUCH_JSAPI_002
* @tc.name Test dialogTargetTouchTest2
...
...
@@ -2391,10 +2326,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
})
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_001
* @tc.name Test setAspectRatioTest1
* @tc.desc Validate the scenario cancelled after setting the proportion of the content layout of the main window
*/
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_001
* @tc.name Test setAspectRatioTest1
* @tc.desc Validate the scenario cancelled after setting the proportion of the content layout of the main window
*/
it
(
'setAspectRatioTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setAspectRatioTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
...
@@ -2456,10 +2391,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
await
resetAspectRatio
()
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_003
* @tc.name Test setAspectRatioTest3
* @tc.desc Validate the scenario where the content layout proportion of the main window is abnormal
*/
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_003
* @tc.name Test setAspectRatioTest3
* @tc.desc Validate the scenario where the content layout proportion of the main window is abnormal
*/
it
(
'setAspectRatioTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setAspectRatioTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
...
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
98585e35
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录