Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
da568dcf
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
da568dcf
编写于
5月 16, 2022
作者:
Z
zhurong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add xts
Signed-off-by:
N
zhurong
<
zhurong18@h-partners.com
>
上级
dd56ec90
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
296 addition
and
67 deletion
+296
-67
graphic/windowStage/entry/src/main/ets/test/List.test.ets
graphic/windowStage/entry/src/main/ets/test/List.test.ets
+2
-2
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+116
-35
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+178
-30
未找到文件。
graphic/windowStage/entry/src/main/ets/test/List.test.ets
浏览文件 @
da568dcf
...
...
@@ -13,9 +13,9 @@
* limitations under the License.
*/
import windowPromiseTest from './windowPromise.test.ets'
import windoCallbackTest from './windowCallback.test.ets'
import windo
w
CallbackTest from './windowCallback.test.ets'
export default function testsuite(context, windowStage, abilityStorage) {
windoCallbackTest(context, windowStage, abilityStorage)
windo
w
CallbackTest(context, windowStage, abilityStorage)
windowPromiseTest(context, windowStage, abilityStorage)
}
\ No newline at end of file
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
da568dcf
...
...
@@ -18,11 +18,11 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import ohosWindow from '@ohos.window';
import display from '@ohos.display';
export default function windoCallbackTest(context, windowStage, abilityStorage) {
export default function windo
w
CallbackTest(context, windowStage, abilityStorage) {
console.log('testets context 1: ' + JSON.stringify(context))
console.log('testets context 1 windowStage 2 : ' + JSON.stringify(windowStage));
describe('window
Api
Callback_test', function () {
describe('windowCallback_test', function () {
console.log('describe testets start!!')
const TRUE_FLAG = true;
console.log('describe window_api_test start!!!');
...
...
@@ -120,7 +120,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test setSystemBarEnableTest10
* @tc.desc Verify the scene where illegal values are entered when the navigation bar and status bar are displayed or hidden
*/
it('setSystemBarEnableTest10', 0,
done =>
{
it('setSystemBarEnableTest10', 0,
function(done)
{
let caseName = 'setSystemBarEnableTest10';
let msgStr = 'jsunittest ' + caseName + ' ';
let [flagStatus, flagNav] = [false, false];
...
...
@@ -182,7 +182,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test setSystemBarPropertiesTest1
* @tc.desc TVerify the scene where the colors of the status bar and navigation bar are set in RGB
*/
it('setSystemBarPropertiesTest4', 0,
done =>
{
it('setSystemBarPropertiesTest4', 0,
function(done)
{
let caseName = 'setSystemBarPropertiesTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
let cloneColorArr = JSON.parse(JSON.stringify(commonRGBColorArr));
...
...
@@ -272,7 +272,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test setSystemBarPropertiesTest5
* @tc.desc Verify the scene where the status bar and navigation bar colors are set in hexadecimal form
*/
it('setSystemBarPropertiesTest5', 0,
done =>
{
it('setSystemBarPropertiesTest5', 0,
function(done)
{
let caseName = 'setSystemBarPropertiesTest5';
let msgStr = 'jsunittest ' + caseName + ' ';
let cloneColorArr = {
...
...
@@ -387,7 +387,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test setSystemBarPropertiesTest6
* @tc.desc TVerify the scene where the status bar and navigation bar colors are set as keywords
*/
it('setSystemBarPropertiesTest6', 0,
done =>
{
it('setSystemBarPropertiesTest6', 0,
function(done)
{
let caseName = 'setSystemBarPropertiesTest6';
let msgStr = 'jsunittest ' + caseName + ' ';
let cloneColorArr = JSON.parse(JSON.stringify(commonKEYColorArr));
...
...
@@ -477,7 +477,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test create5
* @tc.desc Verify the scenario of creating the application type window
*/
it('createTest5', 0,
done =>
{
it('createTest5', 0,
function(done)
{
let caseName = 'createTest5';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
...
...
@@ -507,7 +507,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test createTest6
* @tc.desc Verify the scenario of creating the system type window
*/
it('createTest6', 0,
done =>
{
it('createTest6', 0,
function(done)
{
let caseName = 'createTest6';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
...
...
@@ -550,7 +550,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test createTest7
* @tc.desc Verify the scenario of creating a window of a type that does not exist
*/
it('createTest7', 0,
done =>
{
it('createTest7', 0,
function(done)
{
let caseName = 'createTest7';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
...
...
@@ -573,7 +573,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test createTest8
* @tc.desc Verify the scenario of creating a window with duplicate IDs
*/
it('createTest8', 0,
done =>
{
it('createTest8', 0,
function(done)
{
let caseName = 'createTest8';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
...
...
@@ -602,7 +602,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test listenerTest5
* @tc.desc Verify whether the change of avoidance area and change monitoring can be turned on normally
*/
it('listenerTest5', 0,
done =>
{
it('listenerTest5', 0,
function(done)
{
let caseName = 'listenerTest5';
let msgStr = 'jsunittest ' + caseName + ' ';
let listenerOnFlag = listenerStatus.ready;
...
...
@@ -629,6 +629,15 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
}
expect(!data).assertTrue();
console.log(msgStr + 'tempWnd.setFullScreen(true) success');
tempWnd.on('systemAvoidAreaChange', avoidAreaData => {
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange, avoidAreaData : ' + JSON.stringify(avoidAreaData));
if (listenerOnFlag === listenerStatus.pending) {
listenerOnFlag = listenerStatus.finished;
expect(!!avoidAreaData).assertTrue();
}
done();
})
tempWnd.setSystemBarEnable([], (err,data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([])', done);
...
...
@@ -636,32 +645,24 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
expect(!data).assertTrue();
console.log(msgStr + 'tempWnd.setSystemBarEnable([]) success');
listenerOnFlag = listenerStatus.pending;
tempWnd.on('systemAvoidAreaChange', avoidAreaData => {
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange, avoidAreaData : ' + JSON.stringify(avoidAreaData));
if (listenerOnFlag === listenerStatus.pending) {
listenerOnFlag = listenerStatus.finished;
expect(!!avoidAreaData).assertTrue();
done();
tempWnd.setSystemBarEnable(['status', 'navigation'], (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status, navigation])', done);
}
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
})
}
})
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange finished');
})
tempWnd.setSystemBarEnable(['status', 'navigation'], (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status, navigation])', done);
}
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
})
console.log(msgStr + 'tempWnd.on systemAvoidAreaChange finished');
})
})
})
})
/**
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_003
* @tc.name Test setWindowTypeTest3
* @tc.desc Verify the scenario where the normal window type is set
*/
it('setWindowTypeTest3', 0,
done =>
{
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_003
* @tc.name Test setWindowTypeTest3
* @tc.desc Verify the scenario where the normal window type is set
*/
it('setWindowTypeTest3', 0,
function(done)
{
let caseName = 'setWindowTypeTest3';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
...
...
@@ -722,7 +723,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test setWindowTypeTest4
* @tc.desc Verify the scene of setting illegal window type
*/
it('setWindowTypeTest4', 0,
done =>
{
it('setWindowTypeTest4', 0,
function(done)
{
let caseName = 'setWindowTypeTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
...
...
@@ -758,7 +759,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test destroyTest2
* @tc.desc Verification window destruction scenario
*/
it('destroyTest2', 0,
done =>
{
it('destroyTest2', 0,
function(done)
{
let caseName = 'destroyTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
...
...
@@ -803,7 +804,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test loadContentTest3
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest3', 0,
done =>
{
it('loadContentTest3', 0,
function(done)
{
let caseName = 'loadContentTest3';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
...
...
@@ -838,7 +839,7 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
* @tc.name Test loadContentTest4
* @tc.desc Verify the scenario of loading a page that does not exist
*/
it('loadContentTest4', 0,
done =>
{
it('loadContentTest4', 0,
function(done)
{
let caseName = 'loadContentTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
...
...
@@ -868,5 +869,85 @@ export default function windoCallbackTest(context, windowStage, abilityStorage)
}
})
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_007
* @tc.name Test loadContentTest7
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest7', 0, async function (done) {
let caseName = 'loadContentTest7';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.loadContent('pages/index/index.ets',(err,data) => {
if(err&&err.code){
unexpectedError(err, caseName, 'windowStage.loadContent', done);
console.log(msgStr+'windowStage.loadContent(pages/index/index.ets)'+JSON.stringify(err));
}else{
expect(!data).assertTrue();
console.log(msgStr + 'windowStage.loadContent end data='+JSON.stringify(data));
}
done();
});
})
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_003
* @tc.name Test createSubWindowTest3
* @tc.desc Verify the scenario of creating an auxiliary window
*/
it('createSubWindowTest3', 0, function (done) {
let caseName = 'createSubWindowTest3';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.createSubWindow('createSubWindowTest3',(err,data)=> {
if(err&&err.code){
unexpectedError(err, caseName, 'windowStage.createSubWindow', done);
console.log(msgStr+'windowStage.createSubWindow(createSubWindowTest3) err='+JSON.stringify(err));
}else{
expect(!!data).assertTrue();
console.log(msgStr + 'windowStage.createSubWindow end data='+JSON.stringify(data));
}
done();
});
})
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_004
* @tc.name Test createSubWindowTest4
* @tc.desc Verify the scene of entering illegal values to create an auxiliary window
*/
it('createSubWindowTest4', 0, function (done) {
let caseName = 'createSubWindowTest4';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
windowStage.createSubWindow(null,(err,data)=> {
if(err&&err.code){
expectedError(err, caseName, 'windowStage.createSubWindow', done,130);
console.log(msgStr+'windowStage.createSubWindow(null) err='+JSON.stringify(err));
}else{
expect(false).assertTrue();
console.log(msgStr + 'windowStage.createSubWindow end data='+JSON.stringify(data));
}
done();
});
})
/**
* @tc.number SUB_WINDOW_GETSUBWINDOW_JSAPI_002
* @tc.name Test getSubWindowTest2
* @tc.desc Verify the scene of obtaining all auxiliary sub windows
*/
it('getSubWindowTest2', 0, async function (done) {
let caseName = 'getSubWindowTest2';
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{
expect(!!data).assertTrue();
console.log(msgStr + 'windowStage.getSubWindow end data='+JSON.stringify(data));
}
done();
});
})
})
}
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
da568dcf
...
...
@@ -19,7 +19,7 @@ import ohosWindow from '@ohos.window';
export default function windowPromiseTest(context, windowStage) {
console.log('windowTest context: ' + JSON.stringify(context))
describe('window
_api
_test', function () {
describe('window
Promise
_test', function () {
console.log('describe window_api_test start!!!')
const TRUE_FLAG = true;
var commonRGBColorArr = ['rgb(255,0,0)', 'rgb(0,255,0)', 'rgb(0,0,255)', 'rgb(255,255,255)', 'rgb(0,0,0)', 'rgb(249,0,230)', 'rgb(102,102,102)', 'rgb(255,247,0)'];
...
...
@@ -34,6 +34,7 @@ export default function windowPromiseTest(context, windowStage) {
};
var systemWindowValueArr = [];
var systemWindowTypeArr = [];
var systemWindowTypeDicArr = [];
var systemWindowTypeDic = {
'TYPE_SYSTEM_ALERT': 1,
'TYPE_INPUT_METHOD': 2,
...
...
@@ -64,7 +65,7 @@ export default function windowPromiseTest(context, windowStage) {
beforeAll(function () {
console.log('jsunittest beforeall ohosWindow.WindowType='+JSON.stringify(ohosWindow.WindowType));
appWindowTypeArr = Object.keys(app
WindowTypeDic);
systemWindowTypeDicArr = Object.keys(system
WindowTypeDic);
systemWindowValueArr = Object.keys(systemWindowTypeDic);
systemWindowTypeArr = Object.keys(systemWindowTypeDic);
for(i in ohosWindow.WindowType){
...
...
@@ -90,10 +91,12 @@ export default function windowPromiseTest(context, windowStage) {
afterAll(function () {
})
function expectedError(error, caseName, apiName, done) {
function expectedError(error, caseName, apiName, done
,code
) {
let msgStr = 'jsunittest ' + caseName + ' ' + apiName + ' failed, err: ';
console.log(msgStr + JSON.stringify(error));
expect(TRUE_FLAG).assertTrue();
if(error.code === code){
expect(TRUE_FLAG).assertTrue();
}
done();
}
...
...
@@ -142,11 +145,9 @@ export default function windowPromiseTest(context, windowStage) {
navigationFlag = listenerStatus.finished;
expect(!tempData.isEnable).assertTrue();
}
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
done();
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -211,11 +212,12 @@ export default function windowPromiseTest(context, windowStage) {
navigationFlag = listenerStatus.finished;
expect(tempData.isEnable).assertTrue();
}
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
done();
}
//
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
//
done();
//
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -280,11 +282,12 @@ export default function windowPromiseTest(context, windowStage) {
navigationFlag = listenerStatus.finished;
expect(tempData.isEnable).assertTrue();
}
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
done();
}
//
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
//
done();
//
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -310,13 +313,13 @@ export default function windowPromiseTest(context, windowStage) {
await tempWnd.setSystemBarEnable(['status', 'navigation']).catch((err) => {
unexpectedError(err, caseName, 'tempWnd.setSystemBarEnable([status, navigation])', done);
});
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success');
setTimeout(() => {
if (statusFlag !== listenerStatus.finished || navigationFlag !== listenerStatus.finished) {
let apiStr = 'tempWnd.on systemBarTintChange time wait';
unexpectedError(null, caseName, apiStr, done);
}
}, 5000)
console.log(msgStr + 'tempWnd.setSystemBarEnable([status, navigation]) success
.
');
//
setTimeout(() => {
//
if (statusFlag !== listenerStatus.finished || navigationFlag !== listenerStatus.finished) {
//
let apiStr = 'tempWnd.on systemBarTintChange time wait';
//
unexpectedError(null, caseName, apiStr, done);
//
}
//
}, 5000)
})
/**
...
...
@@ -349,11 +352,12 @@ export default function windowPromiseTest(context, windowStage) {
navigationFlag = listenerStatus.finished;
expect(!tempData.isEnable).assertTrue();
}
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
done();
}
//
if (statusFlag === listenerStatus.finished && navigationFlag === listenerStatus.finished) {
//
done();
//
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -400,7 +404,7 @@ export default function windowPromiseTest(context, windowStage) {
let tempWnd = await windowStage.getMainWindow().catch((err) => {
unexpectedError(err, caseName, 'windowStage.getMainWindow', done);
});
console.log(msgStr + 'windowStage.getMainWindow, tempWnd: ' +
tempWnd
);
console.log(msgStr + 'windowStage.getMainWindow, tempWnd: ' +
JSON.stringify(tempWnd)
);
expect(!!tempWnd).assertTrue();
await tempWnd.show().catch((err) => {
unexpectedError(err, caseName, 'tempWnd.show', done);
...
...
@@ -408,6 +412,7 @@ export default function windowPromiseTest(context, windowStage) {
console.log(msgStr + 'tempWnd.show success');
await tempWnd.setFullScreen(true).catch((err) => {
unexpectedError(err, caseName, 'tempWnd.setFullScreen(true)', done);
console.log(msgStr + 'tempWnd.setFullScreen(true) err'+JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.setFullScreen(true) success');
await tempWnd.setSystemBarEnable([]).catch((err) => {
...
...
@@ -415,7 +420,9 @@ export default function windowPromiseTest(context, windowStage) {
});
console.log(msgStr + 'tempWnd.setSystemBarEnable([]) success');
await tempWnd.setSystemBarEnable([null, '123']).catch((err) => {
expectedError(err, caseName, 'tempWnd.setSystemBarEnable([null, 123])', done);
console.log(msgStr + 'tempWnd.setSystemBarEnable([null, 123]) err='+JSON.stringify(err));
expect(err.code === 130).assertTrue();
done();
});
console.log(msgStr + 'tempWnd.setSystemBarEnable([null, 123]) finished');
})
...
...
@@ -452,6 +459,7 @@ export default function windowPromiseTest(context, windowStage) {
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -555,6 +563,7 @@ export default function windowPromiseTest(context, windowStage) {
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -592,7 +601,6 @@ export default function windowPromiseTest(context, windowStage) {
}, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
expect(TRUE_FLAG).assertFail();
done();
})
}
setTimeout(() => {
...
...
@@ -629,6 +637,7 @@ export default function windowPromiseTest(context, windowStage) {
let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
console.log(msgStr +'i='+i+ ' , ohosWindow.on for='+JSON.stringify(tempData));
if (tempData.type === 2108 || tempData.type === 2112) {
console.log(msgStr + 'systemBarTintChange compare start!');
compareCount++;
...
...
@@ -639,6 +648,7 @@ export default function windowPromiseTest(context, windowStage) {
}
}
}
done();
})
console.log(msgStr + 'tempWnd.on systemBarTintChange finished');
let tempWnd = await windowStage.getMainWindow().catch((err) => {
...
...
@@ -698,17 +708,15 @@ export default function windowPromiseTest(context, windowStage) {
let loopCount = appWindowTypeArr.length;
console.log('jsunittest loopCount: ' + loopCount);
for (let i = 0; i < loopCount; i++) {
let tempType =
appWindowTypeDic[appWindowType
Arr[i]];
let tempType =
systemWindowTypeDic[systemWindowTypeDic
Arr[i]];
let windId = 'createTest1' + i;
console.log(msgStr + 'ohosWindow.create ' + tempType + ' start');
let tempWnd = await ohosWindow.create(context, windId, tempType).catch((err) => {
console.log(msgStr + 'ohosWindow.create ' + tempType + 'catched, err: ' + JSON.stringify(err));
expectedError(err, caseName, 'ohosWindow.create ' + tempType, done);
un
expectedError(err, caseName, 'ohosWindow.create ' + tempType, done);
});
console.log(msgStr + 'ohosWindow.create ' + tempType + 'finished, wnd: ' + tempWnd);
expect(!tempWnd).assertTrue();
if (i === loopCount - 1) {
}
}
console.log(msgStr + 'done ');
done();
...
...
@@ -731,5 +739,145 @@ export default function windowPromiseTest(context, windowStage) {
done();
});
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_001
* @tc.name Test loadContentTest1
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest1', 0, async function (done) {
let caseName = 'loadContentTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
let windowId = 'loadContentTest1';
console.log(msgStr + 'begin');
let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create', done);
});
console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' , wnd: ' + tempWnd);
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'tempWnd.loadContent start');
let load = await tempWnd.loadContent('pages/second/second').catch((err) => {
unexpectedError(err, caseName, 'tempWnd.loadContent', done);
console.log(msgStr+'tempWnd.loadContent(pages/second/second) err='+JSON.stringify(err));
});
console.log(msgStr+'tempWnd.loadContent(pages/second/second) load='+JSON.stringify(load));
expect(!load).assertTrue();
done();
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_002
* @tc.name Test loadContentTest2
* @tc.desc Verify the scene of loading the page with illegal values
*/
it('loadContentTest2', 0, async function (done) {
let caseName = 'loadContentTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
let baseWndType = 1;
let windowId = 'loadContentTest2';
console.log(msgStr + 'begin');
let tempWnd = await ohosWindow.create(context, windowId, baseWndType).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create', done);
});
console.log(msgStr + 'ohosWindow.create ' + baseWndType + ' wnd: ' + tempWnd);
expect(!!tempWnd).assertTrue();
console.log(msgStr + 'tempWnd.loadContent start');
let errFlag = false;
await tempWnd.loadContent(null).catch((err) => {
errFlag = true;
expectedError(err, caseName, 'tempWnd.loadContent', done, 130);
console.log(msgStr+'tempWnd.loadContent(null)'+JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent end');
if (!errFlag) {
console.log(msgStr + 'should report err');
expect(TRUE_FLAG).assertFail();
done();
}
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_005
* @tc.name Test loadContentTest5
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest5', 0, async function (done) {
let caseName = 'loadContentTest5';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let load5 = 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));
});
expect(!load5).assertTrue();
console.log(msgStr + 'tempWnd.loadContent end load='+JSON.stringify(load5));
done();
})
/**
* @tc.number SUB_WINDOW_LOADCONTENT_JSAPI_006
* @tc.name Test loadContentTest6
* @tc.desc Verify the scenario of loading an existing page
*/
it('loadContentTest6', 0, async function (done) {
let caseName = 'loadContentTest6';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let load6 = await windowStage.loadContent(null).catch((err) => {
expectedError(err, caseName, 'tempWnd.loadContent', done, 130);
console.log(msgStr+'tempWnd.loadContent(null)'+JSON.stringify(err));
});
console.log(msgStr + 'tempWnd.loadContent end load='+JSON.stringify(load6));
done();
})
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_001
* @tc.name Test createSubWindowTest1
* @tc.desc Verify the scenario of creating an auxiliary window
*/
it('createSubWindowTest1', 0, async function (done) {
let caseName = 'createSubWindowTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let subWindow = await windowStage.createSubWindow('createSubWindowTest1').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));
done();
})
/**
* @tc.number SUB_WINDOW_CREATESUBWINDOW_JSAPI_002
* @tc.name Test createSubWindowTest2
* @tc.desc Verify the scene of entering illegal values to create an auxiliary window
*/
it('createSubWindowTest2', 0, async function (done) {
let caseName = 'createSubWindowTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let subWindow = await windowStage.createSubWindow(null).catch((err) => {
expectedError(err, caseName, 'windowStage.createSubWindow', done,130);
console.log(msgStr+'windowStage.createSubWindow(null) err='+JSON.stringify(err));
});
console.log(msgStr + 'windowStage.createSubWindow end subWindow='+JSON.stringify(subWindow));
done();
})
/**
* @tc.number SUB_WINDOW_GETSUBWINDOW_JSAPI_001
* @tc.name Test getSubWindowTest1
* @tc.desc Verify the scene of obtaining all auxiliary sub windows
*/
it('getSubWindowTest1', 0, async function (done) {
let caseName = 'getSubWindowTest1';
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();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录