Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
779caa7b
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
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看板
提交
779caa7b
编写于
4月 03, 2023
作者:
Y
yaocui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update case
Signed-off-by:
N
yaocui
<
yaocui2@h-partners.com
>
上级
69091d0d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
271 addition
and
164 deletion
+271
-164
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+271
-164
未找到文件。
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
779caa7b
...
@@ -87,7 +87,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -87,7 +87,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
function
expectedError
(
error
,
caseName
,
apiName
,
done
,
code
)
{
function
expectedError
(
error
,
caseName
,
apiName
,
done
,
code
)
{
let
msgStr
=
'jsunittest '
+
caseName
+
' '
+
apiName
+
' failed, err: '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
+
apiName
+
' failed, err: '
;
console
.
log
(
msgStr
+
JSON
.
stringify
(
error
));
console
.
log
(
msgStr
+
JSON
.
stringify
(
error
));
if
(
error
.
code
==
=
code
)
{
if
(
error
.
code
==
code
)
{
expect
(
TRUE_FLAG
)
.
assertTrue
();
expect
(
TRUE_FLAG
)
.
assertTrue
();
}
}
done
();
done
();
...
@@ -111,10 +111,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -111,10 +111,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
clearTimeout
(
timeoutId
)
clearTimeout
(
timeoutId
)
}
}
/**
/**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_001
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_001
* @tc.name Test listenerTest1
* @tc.name Test listenerTest1
* @tc.desc Verify whether the change monitoring of avoidance area can be started normally.
* @tc.desc Verify whether the change monitoring of avoidance area can be started normally.
*/
*/
it
(
'listenerTest1'
,
0
,
async
function
(
done
)
{
it
(
'listenerTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'listenerTest1'
;
let
caseName
=
'listenerTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -132,6 +132,8 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -132,6 +132,8 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'tempWnd.on systemAvoidAreaChange, listenerOnFlag : '
+
JSON
.
stringify
(
listenerOnFlag
));
console
.
log
(
msgStr
+
'tempWnd.on systemAvoidAreaChange, listenerOnFlag : '
+
JSON
.
stringify
(
listenerOnFlag
));
if
(
listenerOnFlag
)
{
if
(
listenerOnFlag
)
{
expect
(
!!
avoidAreaData
)
.
assertTrue
();
expect
(
!!
avoidAreaData
)
.
assertTrue
();
tempWnd
.
off
(
'systemAvoidAreaChange'
);
done
();
}
}
})
})
expect
(
!!
tempWnd
)
.
assertTrue
();
expect
(
!!
tempWnd
)
.
assertTrue
();
...
@@ -147,23 +149,19 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -147,23 +149,19 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
unexpectedError
(
err
,
caseName
,
'tempWnd.setSystemBarEnable([])'
,
done
);
unexpectedError
(
err
,
caseName
,
'tempWnd.setSystemBarEnable([])'
,
done
);
});
});
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([]) success'
);
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([]) success'
);
console
.
log
(
msgStr
+
'tempWnd.on systemAvoidAreaChange finished'
);
listenerOnFlag
=
true
;
listenerOnFlag
=
true
;
await
sleep
(
1000
);
await
sleep
(
1000
);
await
tempWnd
.
setSystemBarEnable
([
'status'
,
'navigation'
])
.
catch
((
err
)
=>
{
await
tempWnd
.
setSystemBarEnable
([
'status'
,
'navigation'
])
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.setSystemBarEnable([status, navigation])'
,
done
);
unexpectedError
(
err
,
caseName
,
'tempWnd.setSystemBarEnable([status, navigation])'
,
done
);
});
});
await
tempWnd
.
off
(
'systemAvoidAreaChange'
);
done
();
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([status, navigation]) success'
);
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([status, navigation]) success'
);
})
})
/**
/**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_002
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_002
* @tc.name Test listenerTest2
* @tc.name Test listenerTest2
* @tc.desc Verify that the window size avoidance area changes and monitor whether it can be opened normally.
* @tc.desc Verify that the window size avoidance area changes and monitor whether it can be opened normally.
*/
*/
it
(
'listenerTest2'
,
0
,
async
function
(
done
)
{
it
(
'listenerTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'listenerTest2'
;
let
caseName
=
'listenerTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -224,10 +222,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -224,10 +222,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'tempWnd.resetSize('
+
resizeValue
+
', '
+
resizeValue
+
') success'
);
console
.
log
(
msgStr
+
'tempWnd.resetSize('
+
resizeValue
+
', '
+
resizeValue
+
') success'
);
})
})
/**
/**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_003
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_003
* @tc.name Test listenerTest3
* @tc.name Test listenerTest3
* @tc.desc Verify whether the change monitoring of avoidance area can be started normally.
* @tc.desc Verify whether the change monitoring of avoidance area can be started normally.
*/
*/
it
(
'listenerTest3'
,
0
,
async
function
(
done
)
{
it
(
'listenerTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'listenerTest3'
;
let
caseName
=
'listenerTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -269,10 +267,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -269,10 +267,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([status, navigation]) success'
);
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([status, navigation]) success'
);
})
})
/**
/**
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_004
* @tc.number SUB_WINDOW_ON_OFF_JSAPI_004
* @tc.name Test listenerTest4
* @tc.name Test listenerTest4
* @tc.desc Verify whether the window size change monitoring can be closed normally.
* @tc.desc Verify whether the window size change monitoring can be closed normally.
*/
*/
it
(
'listenerTest4'
,
0
,
async
function
(
done
)
{
it
(
'listenerTest4'
,
0
,
async
function
(
done
)
{
let
caseName
=
'listenerTest4'
;
let
caseName
=
'listenerTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -338,10 +336,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -338,10 +336,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'finished'
);
console
.
log
(
msgStr
+
'finished'
);
})
})
/**
/**
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_001
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_001
* @tc.name Test setWindowTypeTest1
* @tc.name Test setWindowTypeTest1
* @tc.desc Test window.setWindowType API function test.
* @tc.desc Test window.setWindowType API function test.
*/
*/
it
(
'setWindowTypeTest1'
,
0
,
async
function
(
done
)
{
it
(
'setWindowTypeTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setWindowTypeTest1'
;
let
caseName
=
'setWindowTypeTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -392,10 +390,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -392,10 +390,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
}
})
})
/**
/**
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_002
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_002
* @tc.name Test setWindowTypeTest2
* @tc.name Test setWindowTypeTest2
* @tc.desc Test window.setWindowType API function test.
* @tc.desc Test window.setWindowType API function test.
*/
*/
it
(
'setWindowTypeTest2'
,
0
,
async
function
(
done
)
{
it
(
'setWindowTypeTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setWindowTypeTest2'
;
let
caseName
=
'setWindowTypeTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -429,10 +427,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -429,10 +427,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
}
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_001
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_001
* @tc.name Test setSystemBarEnableTest1
* @tc.name Test setSystemBarEnableTest1
* @tc.desc Verify that the scene shows the status bar and hides the navigation bar
* @tc.desc Verify that the scene shows the status bar and hides the navigation bar
*/
*/
it
(
'setSystemBarEnableTest1'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarEnableTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest1'
;
let
caseName
=
'setSystemBarEnableTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -490,10 +488,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -490,10 +488,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([navigation]) success'
);
console
.
log
(
msgStr
+
'tempWnd.setSystemBarEnable([navigation]) success'
);
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_002
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_002
* @tc.name Test setSystemBarEnableTest2
* @tc.name Test setSystemBarEnableTest2
* @tc.desc Verify that the scene hides the status bar and displays the navigation bar
* @tc.desc Verify that the scene hides the status bar and displays the navigation bar
*/
*/
it
(
'setSystemBarEnableTest2'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarEnableTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest2'
;
let
caseName
=
'setSystemBarEnableTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -551,10 +549,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -551,10 +549,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_003
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_003
* @tc.name Test setSystemBarEnableTest3
* @tc.name Test setSystemBarEnableTest3
* @tc.desc Verify that the scene displays both the status bar and the navigation bar
* @tc.desc Verify that the scene displays both the status bar and the navigation bar
*/
*/
it
(
'setSystemBarEnableTest3'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarEnableTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest3'
;
let
caseName
=
'setSystemBarEnableTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -612,10 +610,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -612,10 +610,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_004
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_004
* @tc.name Test setSystemBarEnableTest4
* @tc.name Test setSystemBarEnableTest4
* @tc.desc Verify that the scene hides both the status bar and the navigation bar
* @tc.desc Verify that the scene hides both the status bar and the navigation bar
*/
*/
it
(
'setSystemBarEnableTest4'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarEnableTest4'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest4'
;
let
caseName
=
'setSystemBarEnableTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -673,10 +671,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -673,10 +671,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_005
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_005
* @tc.name Test setSystemBarEnableTest5
* @tc.name Test setSystemBarEnableTest5
* @tc.desc Verify the scene where illegal values are entered when the status bar and navigation bar are displayed
* @tc.desc Verify the scene where illegal values are entered when the status bar and navigation bar are displayed
*/
*/
it
(
'setSystemBarEnableTest5'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarEnableTest5'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarEnableTest5'
;
let
caseName
=
'setSystemBarEnableTest5'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -708,10 +706,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -708,10 +706,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_001
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_001
* @tc.name Test setSystemBarPropertiesTest1
* @tc.name Test setSystemBarPropertiesTest1
* @tc.desc Verify the scene where the colors of the status bar and navigation bar are set in RGB
* @tc.desc Verify the scene where the colors of the status bar and navigation bar are set in RGB
*/
*/
it
(
'setSystemBarPropertiesTest1'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarPropertiesTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarPropertiesTest1'
;
let
caseName
=
'setSystemBarPropertiesTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -782,10 +780,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -782,10 +780,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_002
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_002
* @tc.name Test setSystemBarPropertiesTest2
* @tc.name Test setSystemBarPropertiesTest2
* @tc.desc Verify the scene where the status bar and navigation bar colors are set in hexadecimal form
* @tc.desc Verify the scene where the status bar and navigation bar colors are set in hexadecimal form
*/
*/
it
(
'setSystemBarPropertiesTest2'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarPropertiesTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarPropertiesTest2'
;
let
caseName
=
'setSystemBarPropertiesTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -880,10 +878,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -880,10 +878,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_003
* @tc.number SUB_WINDOW_SETSYSTEMBARPROPERTIES_JSAPI_003
* @tc.name Test setSystemBarPropertiesTest3
* @tc.name Test setSystemBarPropertiesTest3
* @tc.desc Verify the scene where the status bar and navigation bar colors are set as keywords
* @tc.desc Verify the scene where the status bar and navigation bar colors are set as keywords
*/
*/
it
(
'setSystemBarPropertiesTest3'
,
0
,
async
function
(
done
)
{
it
(
'setSystemBarPropertiesTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setSystemBarPropertiesTest3'
;
let
caseName
=
'setSystemBarPropertiesTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -956,10 +954,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -956,10 +954,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_001
* @tc.number SUB_WINDOW_CREATE_JSAPI_001
* @tc.name Test create
* @tc.name Test create
* @tc.desc Verify the scenario of creating the application type window
* @tc.desc Verify the scenario of creating the application type window
*/
*/
it
(
'createTest1'
,
0
,
async
function
(
done
)
{
it
(
'createTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createTest1'
;
let
caseName
=
'createTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -987,10 +985,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -987,10 +985,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_002
* @tc.number SUB_WINDOW_CREATE_JSAPI_002
* @tc.name Test createTest2
* @tc.name Test createTest2
* @tc.desc Verify the scenario of creating the system type window
* @tc.desc Verify the scenario of creating the system type window
*/
*/
it
(
'createTest2'
,
0
,
async
function
(
done
)
{
it
(
'createTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createTest2'
;
let
caseName
=
'createTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1041,10 +1039,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1041,10 +1039,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_003
* @tc.number SUB_WINDOW_CREATE_JSAPI_003
* @tc.name Test createTest3
* @tc.name Test createTest3
* @tc.desc Verify the scenario of creating a window of a type that does not exist
* @tc.desc Verify the scenario of creating a window of a type that does not exist
*/
*/
it
(
'createTest3'
,
0
,
async
function
(
done
)
{
it
(
'createTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createTest3'
;
let
caseName
=
'createTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1059,10 +1057,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1059,10 +1057,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
});
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATE_JSAPI_004
* @tc.number SUB_WINDOW_CREATE_JSAPI_004
* @tc.name Test createTest4
* @tc.name Test createTest4
* @tc.desc Verify the scenario of creating a window with duplicate IDs
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
*/
it
(
'createTest4'
,
0
,
async
function
(
done
)
{
it
(
'createTest4'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createTest4'
;
let
caseName
=
'createTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1079,17 +1077,17 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1079,17 +1077,17 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
expect
(
!!
ohosData
)
.
assertTrue
();
expect
(
!!
ohosData
)
.
assertTrue
();
let
ohosDataError
=
await
ohosWindow
.
create
(
context
,
windowId
,
1
)
.
catch
((
err
)
=>
{
let
ohosDataError
=
await
ohosWindow
.
create
(
context
,
windowId
,
1
)
.
catch
((
err
)
=>
{
console
.
log
(
msgStr
+
'ohosWindow.create 1 twice err: '
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'ohosWindow.create 1 twice err: '
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
)
.
assertEqual
(
1001
)
expect
(
err
.
code
)
.
assertEqual
(
1
300
001
)
done
();
done
();
})
})
await
ohosData
.
destroy
();
await
ohosData
.
destroy
();
console
.
log
(
msgStr
+
'ohosWindow.create 1 twice ohosDataError: '
+
JSON
.
stringify
(
ohosDataError
));
console
.
log
(
msgStr
+
'ohosWindow.create 1 twice ohosDataError: '
+
JSON
.
stringify
(
ohosDataError
));
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_001
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_001
* @tc.name Test loadContentTest1
* @tc.name Test loadContentTest1
* @tc.desc Verify the scenario of loading an existing page
* @tc.desc Verify the scenario of loading an existing page
*/
*/
it
(
'loadContentTest1'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest1'
;
let
caseName
=
'loadContentTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1123,10 +1121,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1123,10 +1121,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_002
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_002
* @tc.name Test loadContentTest2
* @tc.name Test loadContentTest2
* @tc.desc Verify the scene of loading the page with illegal values
* @tc.desc Verify the scene of loading the page with illegal values
*/
*/
it
(
'loadContentTest2'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest2'
;
let
caseName
=
'loadContentTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1173,10 +1171,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1173,10 +1171,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_003
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_003
* @tc.name Test loadContentTest3
* @tc.name Test loadContentTest3
* @tc.desc Verify the scenario of loading an existing page
* @tc.desc Verify the scenario of loading an existing page
*/
*/
it
(
'loadContentTest3'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest3'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest3'
;
let
caseName
=
'loadContentTest3'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1190,10 +1188,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1190,10 +1188,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_004
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_004
* @tc.name Test loadContentTest4
* @tc.name Test loadContentTest4
* @tc.desc Verify the scenario of loading an existing page
* @tc.desc Verify the scenario of loading an existing page
*/
*/
it
(
'loadContentTest4'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest4'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest4'
;
let
caseName
=
'loadContentTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1201,21 +1199,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1201,21 +1199,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
try
{
try
{
let
load4
=
await
windowStage
.
loadContent
(
null
)
.
catch
((
err
)
=>
{
let
load4
=
await
windowStage
.
loadContent
(
null
)
.
catch
((
err
)
=>
{
expect
(
false
)
.
assertTrue
();
expect
(
false
)
.
assertTrue
();
console
.
log
(
msgStr
+
'windowStage loadContent
(null)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage loadContent
null
'
+
JSON
.
stringify
(
err
));
});
});
console
.
log
(
msgStr
+
'windowStage loadContent end load5='
+
JSON
.
stringify
(
load4
));
console
.
log
(
msgStr
+
'windowStage loadContent end load5='
+
JSON
.
stringify
(
load4
));
}
}
catch
(
err
)
{
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
);
expectedError
(
err
.
code
,
caseName
,
'tempWnd.loadContent'
,
done
,
401
);
}
}
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_005
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_005
* @tc.name Test loadContentTest5
* @tc.name Test loadContentTest5
* @tc.desc Verify the scenario of loading an existing page
* @tc.desc Verify the scenario of loading an existing page
*/
*/
it
(
'loadContentTest5'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest5'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest5'
;
let
caseName
=
'loadContentTest5'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1223,21 +1221,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1223,21 +1221,21 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
try
{
try
{
let
load5
=
await
windowStage
.
loadContent
(
null
,
abilityStorage
)
.
catch
((
err
)
=>
{
let
load5
=
await
windowStage
.
loadContent
(
null
,
abilityStorage
)
.
catch
((
err
)
=>
{
expect
(
false
)
.
assertTrue
();
expect
(
false
)
.
assertTrue
();
console
.
log
(
msgStr
+
'windowStage loadContent
(null)
'
+
JSON
.
stringify
(
err
));
console
.
log
(
msgStr
+
'windowStage loadContent
null
'
+
JSON
.
stringify
(
err
));
});
});
console
.
log
(
msgStr
+
'windowStage loadContent end load5='
+
JSON
.
stringify
(
load5
));
console
.
log
(
msgStr
+
'windowStage loadContent end load5='
+
JSON
.
stringify
(
load5
));
}
}
catch
(
err
)
{
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
);
expectedError
(
err
.
code
,
caseName
,
'
windowStage
loadContent'
,
done
,
401
);
}
}
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_006
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_006
* @tc.name Test loadContentTest6
* @tc.name Test loadContentTest6
* @tc.desc Verify the scenario of loading an existing page
* @tc.desc Verify the scenario of loading an existing page
*/
*/
it
(
'loadContentTest6'
,
0
,
async
function
(
done
)
{
it
(
'loadContentTest6'
,
0
,
async
function
(
done
)
{
let
caseName
=
'loadContentTest6'
;
let
caseName
=
'loadContentTest6'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1250,10 +1248,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1250,10 +1248,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_001
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_001
* @tc.name Test createSubWindowTest1
* @tc.name Test createSubWindowTest1
* @tc.desc Verify the scenario of creating an auxiliary window
* @tc.desc Verify the scenario of creating an auxiliary window
*/
*/
it
(
'createSubWindowTest1'
,
0
,
async
function
(
done
)
{
it
(
'createSubWindowTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createSubWindowTest1'
;
let
caseName
=
'createSubWindowTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1269,10 +1267,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1269,10 +1267,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_002
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_002
* @tc.name Test createSubWindowTest2
* @tc.name Test createSubWindowTest2
* @tc.desc Verify the scene of entering illegal values to create an auxiliary window
* @tc.desc Verify the scene of entering illegal values to create an auxiliary window
*/
*/
it
(
'createSubWindowTest2'
,
0
,
async
function
(
done
)
{
it
(
'createSubWindowTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'createSubWindowTest2'
;
let
caseName
=
'createSubWindowTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1291,10 +1289,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1291,10 +1289,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_GETSUBWINDOW_JSAPI_001
* @tc.number SUB_WINDOW_GETSUBWINDOW_JSAPI_001
* @tc.name Test getSubWindowTest1
* @tc.name Test getSubWindowTest1
* @tc.desc Verify the scene of obtaining all auxiliary sub windows
* @tc.desc Verify the scene of obtaining all auxiliary sub windows
*/
*/
it
(
'getSubWindowTest1'
,
0
,
async
function
(
done
)
{
it
(
'getSubWindowTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'getSubWindowTest1'
;
let
caseName
=
'getSubWindowTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1308,10 +1306,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1308,10 +1306,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_SETPRIVACYMODE_JSAPI_001
* @tc.number SUB_WINDOW_SETPRIVACYMODE_JSAPI_001
* @tc.name Test setPrivacyModeTest1
* @tc.name Test setPrivacyModeTest1
* @tc.desc Verify the scene where the application sub window is set as a security layer
* @tc.desc Verify the scene where the application sub window is set as a security layer
*/
*/
it
(
'setPrivacyModeTest1'
,
0
,
async
function
(
done
)
{
it
(
'setPrivacyModeTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setPrivacyModeTest1'
;
let
caseName
=
'setPrivacyModeTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1358,10 +1356,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1358,10 +1356,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_DESTROY_JSAPI_001
* @tc.number SUB_WINDOW_DESTROY_JSAPI_001
* @tc.name Test destroyTest1
* @tc.name Test destroyTest1
* @tc.desc Verification window destruction scenario.
* @tc.desc Verification window destruction scenario.
*/
*/
it
(
'destroyTest1'
,
0
,
async
function
(
done
)
{
it
(
'destroyTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'destroyTest1'
;
let
caseName
=
'destroyTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1397,10 +1395,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1397,10 +1395,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_001
* @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_001
* @tc.name Test setPreferredOrientationTest1
* @tc.name Test setPreferredOrientationTest1
* @tc.desc Sets the display direction property of the window
* @tc.desc Sets the display direction property of the window
*/
*/
it
(
'setPreferredOrientationTest1'
,
0
,
async
function
(
done
)
{
it
(
'setPreferredOrientationTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setPreferredOrientationTest1'
;
let
caseName
=
'setPreferredOrientationTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1429,10 +1427,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1429,10 +1427,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
}
})
})
/**
/**
* @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_001
* @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_001
* @tc.name Test setForbidSplitMoveTest1
* @tc.name Test setForbidSplitMoveTest1
* @tc.desc Sets whether Windows are forbidden to move in split screen mode
* @tc.desc Sets whether Windows are forbidden to move in split screen mode
*/
*/
it
(
'setForbidSplitMoveTest1'
,
0
,
async
function
(
done
)
{
it
(
'setForbidSplitMoveTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setForbidSplitMoveTest1'
;
let
caseName
=
'setForbidSplitMoveTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1456,10 +1454,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1456,10 +1454,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_001
* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_001
* @tc.name Test snapshotTest1
* @tc.name Test snapshotTest1
* @tc.desc Scenario of screenshot of verification window
* @tc.desc Scenario of screenshot of verification window
*/
*/
it
(
'snapshotTest1'
,
0
,
async
function
(
done
)
{
it
(
'snapshotTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'snapshotTest1'
;
let
caseName
=
'snapshotTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1478,10 +1476,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1478,10 +1476,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_DIALOGTARGETTOUCH_JSAPI_001
* @tc.number SUB_WINDOW_DIALOGTARGETTOUCH_JSAPI_001
* @tc.name Test dialogTargetTouchTest1
* @tc.name Test dialogTargetTouchTest1
* @tc.desc Verify the scenario of opening modal window
* @tc.desc Verify the scenario of opening modal window
*/
*/
it
(
'dialogTargetTouchTest1'
,
0
,
async
function
(
done
)
{
it
(
'dialogTargetTouchTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'dialogTargetTouchTest1'
;
let
caseName
=
'dialogTargetTouchTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1507,10 +1505,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1507,10 +1505,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_ANIMATIONFORSHOWN_JSAPI_001
* @tc.number SUB_WINDOW_ANIMATIONFORSHOWN_JSAPI_001
* @tc.name Test animationForShownTest1
* @tc.name Test animationForShownTest1
* @tc.desc Verify window custom animation configuration of the scene
* @tc.desc Verify window custom animation configuration of the scene
*/
*/
it
(
'animationForShownTest1'
,
0
,
async
function
(
done
)
{
it
(
'animationForShownTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'animationForShownTest1'
;
let
caseName
=
'animationForShownTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1559,10 +1557,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1559,10 +1557,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
done
();
})
})
/**
/**
* @tc.number SUB_WINDOW_GETCUTOUTINFO_JSAPI_001
* @tc.number SUB_WINDOW_GETCUTOUTINFO_JSAPI_001
* @tc.name Test getCutoutInfoTest1
* @tc.name Test getCutoutInfoTest1
* @tc.desc Obtain information about unavailable screen areas such as the hole screen, fringe screen, and waterfall screen
* @tc.desc Obtain information about unavailable screen areas such as the hole screen, fringe screen, and waterfall screen
*/
*/
it
(
'getCutoutInfoTest1'
,
0
,
async
function
(
done
)
{
it
(
'getCutoutInfoTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'getCutoutInfoTest1'
;
let
caseName
=
'getCutoutInfoTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1577,10 +1575,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1577,10 +1575,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
});
});
})
})
/**
/**
* @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_001
* @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_001
* @tc.name Test showWithAnimationTest1
* @tc.name Test showWithAnimationTest1
* @tc.desc Displays the current window, playing an animation in the process
* @tc.desc Displays the current window, playing an animation in the process
*/
*/
it
(
'showWithAnimationTest1'
,
0
,
async
function
(
done
)
{
it
(
'showWithAnimationTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'showWithAnimationTest1'
;
let
caseName
=
'showWithAnimationTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1596,7 +1594,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1596,7 +1594,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
tempWnd
=
data
tempWnd
=
data
console
.
log
(
msgStr
+
'ohosWindow.create '
+
baseType
+
', tempWnd: '
+
JSON
.
stringify
(
tempWnd
));
console
.
log
(
msgStr
+
'ohosWindow.create '
+
baseType
+
', tempWnd: '
+
JSON
.
stringify
(
tempWnd
));
expect
(
!!
tempWnd
)
.
assertTrue
();
expect
(
!!
tempWnd
)
.
assertTrue
();
console
.
info
(
'showWithAnimationTest1 ****'
+
Reflect
.
has
(
tempWnd
,
'showWithAnimation'
))
})
.
catch
((
err
)
=>
{
})
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.create '
+
baseType
,
done
);
unexpectedError
(
err
,
caseName
,
'ohosWindow.create '
+
baseType
,
done
);
});
});
...
@@ -1606,19 +1603,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1606,19 +1603,18 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
}
}
await
tempWnd
.
showWithAnimation
()
.
then
((
data
)
=>
{
await
tempWnd
.
showWithAnimation
()
.
then
((
data
)
=>
{
console
.
info
(
'Succeeded in showing the window with animation. Data: '
+
JSON
.
stringify
(
data
));
console
.
info
(
msgStr
+
'Succeeded in showing the window with animation. Data: '
+
JSON
.
stringify
(
data
));
tempWnd
.
destroy
();
done
();
done
();
})
.
catch
((
err
)
=>
{
})
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'Failed to show the window with animation'
,
done
);
tempWnd
.
destroy
();
expectedError
(
err
,
caseName
,
'tempWnd.showWithAnimation'
,
done
,
202
);
})
})
})
})
/**
/**
* @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_001
* @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_001
* @tc.name Test hideWithAnimationTest1
* @tc.name Test hideWithAnimationTest1
* @tc.desc Hide the current window and play an animation in the process
* @tc.desc Hide the current window and play an animation in the process
*/
*/
it
(
'hideWithAnimationTest1'
,
0
,
async
function
(
done
)
{
it
(
'hideWithAnimationTest1'
,
0
,
async
function
(
done
)
{
let
caseName
=
'hideWithAnimationTest1'
;
let
caseName
=
'hideWithAnimationTest1'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
...
@@ -1658,5 +1654,116 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
...
@@ -1658,5 +1654,116 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console
.
error
(
'Failed to hide the window with animation. Cause: '
+
JSON
.
stringify
(
err
));
console
.
error
(
'Failed to hide the window with animation. Cause: '
+
JSON
.
stringify
(
err
));
})
})
})
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_002
* @tc.name Test setAspectRatioTest2
* @tc.desc Validate the scenario cancelled after setting the proportion of the content layout of the main window
*/
it
(
'setAspectRatioTest2'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setAspectRatioTest2'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
mainWnd
=
null
;
await
windowStage
.
getMainWindow
()
.
then
((
data
)
=>
{
mainWnd
=
data
;
expect
(
!!
mainWnd
)
.
assertTrue
();
console
.
info
(
msgStr
+
'Succeeded in obtaining the main window. Data: '
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to obtain the main window. Cause: '
+
JSON
.
stringify
(
err
));
});
try
{
let
ratio
=
1.0
;
await
mainWnd
.
setAspectRatio
(
ratio
)
.
then
(()
=>
{
console
.
info
(
msgStr
+
'Succeeded in setting aspect ratio of window.'
);
})
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to set the aspect ratio of window. Cause:'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
msgStr
+
'Failed to set the aspect ratio of window. Cause: '
+
JSON
.
stringify
(
exception
));
}
try
{
await
mainWnd
.
resetAspectRatio
()
.
then
(()
=>
{
console
.
info
(
msgStr
+
'Succeeded in resetting aspect ratio of window.'
);
})
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to reset the aspect ratio of window. Cause:'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
msgStr
+
'Failed to reset the aspect ratio of window. Cause: '
+
JSON
.
stringify
(
exception
));
}
done
();
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_004
* @tc.name Test setAspectRatioTest4
* @tc.desc Validate the scenario where the content layout proportion of the main window is abnormal
*/
it
(
'setAspectRatioTest4'
,
0
,
async
function
(
done
)
{
let
caseName
=
'setAspectRatioTest4'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
mainWnd
=
null
;
await
windowStage
.
getMainWindow
()
.
then
((
data
)
=>
{
mainWnd
=
data
;
expect
(
!!
mainWnd
)
.
assertTrue
();
console
.
info
(
msgStr
+
'Succeeded in obtaining the main window. Data: '
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to obtain the main window. Cause: '
+
JSON
.
stringify
(
err
));
});
try
{
let
ratio
=
0
;
await
mainWnd
.
setAspectRatio
(
ratio
)
.
then
(()
=>
{
console
.
info
(
msgStr
+
'Succeeded in setting aspect ratio of window.'
);
})
.
catch
((
err
)
=>
{
console
.
error
(
msgStr
+
'Failed to set the aspect ratio of window. err:'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
msgStr
+
'Failed to set the aspect ratio of window. exception: '
+
JSON
.
stringify
(
exception
));
expectedError
(
exception
,
caseName
,
'mainWnd.setAspectRatio'
,
done
,
401
);
}
})
/**
* @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
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
console
.
log
(
msgStr
+
'ohosWindow.WindowEventType:'
+
JSON
.
stringify
(
ohosWindow
.
WindowEventType
));
try
{
expect
(
1
)
.
assertEqual
(
ohosWindow
.
WindowEventType
.
WINDOW_SHOWN
);
expect
(
2
)
.
assertEqual
(
ohosWindow
.
WindowEventType
.
WINDOW_ACTIVE
);
expect
(
3
)
.
assertEqual
(
ohosWindow
.
WindowEventType
.
WINDOW_INACTIVE
);
expect
(
4
)
.
assertEqual
(
ohosWindow
.
WindowEventType
.
WINDOW_HIDDEN
);
done
();
}
catch
(
err
)
{
console
.
info
(
msgStr
+
'windowEventType error :'
+
JSON
.
stringify
(
err
));
expect
()
.
assertFail
();
done
();
}
})
/**
* @tc.number ORIENTATION_JSAPI_001
* @tc.name Test orientation_Test_001.
* @tc.desc Test the enumeration value of Orientation
*/
it
(
'orientation_Test_001'
,
0
,
async
function
(
done
)
{
let
caseName
=
'orientation_Test_001'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
console
.
log
(
msgStr
+
'display.orientation:'
+
JSON
.
stringify
(
display
.
Orientation
));
try
{
expect
(
0
)
.
assertEqual
(
display
.
Orientation
.
PORTRAIT
);
expect
(
1
)
.
assertEqual
(
display
.
Orientation
.
LANDSCAPE
);
expect
(
2
)
.
assertEqual
(
display
.
Orientation
.
PORTRAIT_INVERTED
);
expect
(
3
)
.
assertEqual
(
display
.
Orientation
.
LANDSCAPE_INVERTED
);
done
();
}
catch
(
err
)
{
console
.
info
(
msgStr
+
'Orientation error :'
+
JSON
.
stringify
(
err
));
expect
()
.
assertFail
();
done
();
}
})
})
})
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录