Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
00bf9d2d
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看板
未验证
提交
00bf9d2d
编写于
6月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3817 补充窗口xts接口
Merge pull request !3817 from 华华小仙女/monthly_20220614
上级
0372e670
7912b08f
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
298 addition
and
50 deletion
+298
-50
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
...ndowStage/entry/src/main/ets/test/windowCallback.test.ets
+95
-22
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+203
-28
未找到文件。
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
00bf9d2d
...
...
@@ -13,7 +13,8 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index"
import ohosWindow from '@ohos.window';
import display from '@ohos.display';
...
...
@@ -116,6 +117,76 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
})
}
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_006
* @tc.name Test setSystemBarEnableTest6
* @tc.desc Test ohosWindow.setSystemBarEnable API function test1.
*/
it('setSystemBarEnableTest6', 0, function (done) {
let caseName = 'setSystemBarEnableTest6';
let msgStr = 'jsunittest ' + caseName + ' ';
let [flagStatus, flagNav] = [false, false];
console.log(msgStr + 'begin');
listenerData.on = true;
listenerData.typeStr = 'systemBarTintChange';
ohosWindow.on('systemBarTintChange', systembartintstate => {
console.log(msgStr + 'ohosWindow.on systembartintstate.regionTint : ' + JSON.stringify(systembartintstate.regionTint));
if (flagStatus || flagNav) {
expect(!!systembartintstate).assertTrue();
expect(!!systembartintstate.regionTint).assertTrue();
console.log(msgStr + 'flagStatus || flagNav' + msgStr + 'ohosWindow.on systemBarTintChange regionTint:' + JSON.stringify(systembartintstate.regionTint));
done();
}
})
let mainWnd = null;
console.log(msgStr + 'mainWnd = null');
console.log(msgStr + 'windowStage = ' + JSON.stringify(windowStage));
windowStage.getMainWindow((err, data) => {
console.log(msgStr + 'getMainWindow data2' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'windowStage.getMainWindow', done);
}
expect(!!data).assertTrue();
mainWnd = data;
console.log(msgStr + 'await windowStage JSON.stringify(mainWnd)===' + JSON.stringify(mainWnd));
mainWnd.show((err, data) => {
console.log(msgStr + 'mainWnd.show err' + JSON.stringify(err));
console.log(msgStr + 'mainWnd.show data' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.show', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.show success');
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen data:' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen true', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.setFullScreen success');
flagNav = true;
mainWnd.setSystemBarEnable(['navigation'], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable navigation JSON.stringify(data)==' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [navigation]', done);
}
expect(!data).assertTrue();
console.log(msgStr + 'mainWnd.setSystemBarEnable success flagNav==' + flagNav);
})
flagStatus = true;
mainWnd.setSystemBarEnable(['status'], (err, data) => {
console.log(msgStr + 'mainWnd.setSystemBarEnable status JSON.stringify(data)===' + JSON.stringify(data));
if (err && err.code) {
console.log(msgStr + 'mainWnd.setSystemBarEnable status JSON.stringify(err)===' + JSON.stringify(err));
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable [status]', done);
}
expect(!data).assertTrue();
})
})
})
})
console.log(msgStr + 'finished!!');
});
/**
* @tc.number SUB_WINDOW_SETSYSTEMBARENABLE_JSAPI_007
* @tc.name Test setSystemBarEnableTest7
* @tc.desc Verify that the scene hides the status bar and displays the navigation bar.
...
...
@@ -203,7 +274,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'mainWnd.show success');
expect(!data).assertTrue();
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen
:
' + JSON.stringify(data));
console.log(msgStr + 'mainWnd.setFullScreen' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen true', done);
}
...
...
@@ -227,7 +298,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'ohosWindow.on isEnable : ' + JSON.stringify(enable));
console.log(msgStr + 'ohosWindow.on numType : ' + JSON.stringify(numType));
expect(numType ===
2112
|| enable).assertTrue();
expect(numType ===
ohosWindow.WindowType.TYPE_NAVIGATION_BAR
|| enable).assertTrue();
}
done();
}, 3000)
...
...
@@ -272,7 +343,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'mainWnd.show success');
expect(!data).assertTrue();
mainWnd.setFullScreen(true, (err, data) => {
console.log(msgStr + 'mainWnd.setFullScreen
:
' + JSON.stringify(data));
console.log(msgStr + 'mainWnd.setFullScreen' + JSON.stringify(data));
if (err && err.code) {
unexpectedError(data, caseName, 'mainWnd.setFullScreen', done);
}
...
...
@@ -300,7 +371,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
unexpectedError(data, caseName, 'mainWnd.setSystemBarEnable []', done);
}
expect(!data).assertTrue();
// done();
})
})
})
...
...
@@ -381,7 +451,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
if (tempData.type ===
2108 || tempData.type === 2112
) {
if (tempData.type ===
ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR
) {
console.log(msgStr + 'systemBarTintChange compare start!');
compareCount++;
let backgroundIndex = cloneColorArr.indexOf(tempData.backgroundColor);
...
...
@@ -476,8 +546,8 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
if (tempData.type ===
2108
) {
console.log(msgStr + 'systemBarTintChange compare start!
'
);
if (tempData.type ===
ohosWindow.WindowType.TYPE_STATUS_BAR
) {
console.log(msgStr + 'systemBarTintChange compare start!
arrLength= '+ arrLength
);
compareCount++;
let backgroundIndex = cloneColorArr.SBC.indexOf(tempData.backgroundColor);
let contentColorIndex = cloneColorArr.SCC.indexOf(tempData.contentColor);
...
...
@@ -487,7 +557,9 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
if (contentColorIndex >= 0) {
cloneColorArr.SCC.splice(contentColorIndex, 1);
}
} else if (tempData.type === 2112) {
console.log(msgStr+'compareCount: '+compareCount +' ,length: '+JSON.stringify(cloneColorArr.SCC.length)+ ' ,cloneColorArr.SBC:'+JSON.stringify(cloneColorArr.SBC));
console.log(msgStr+'compareCount: '+compareCount +' ,length: '+JSON.stringify(cloneColorArr.SCC.length)+' ,cloneColorArr.SCC'+JSON.stringify(cloneColorArr.SCC));
} else if (tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR) {
console.log(msgStr + 'systemBarTintChange compare start!');
compareCount++;
let backgroundIndex = cloneColorArr.NBC.indexOf(tempData.backgroundColor);
...
...
@@ -498,6 +570,17 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
if (contentColorIndex >= 0) {
cloneColorArr.NCC.splice(contentColorIndex, 1);
}
let ca = cloneColorArr;
let flag = ca.NCC.length || ca.NBC.length || ca.SBC.length || ca.SCC.length
if(compareCount===18&&!flag){
console.log(msgStr + 'compareCount: '+compareCount +' ,true flag:'+flag);
expect(true).assertTrue();
done();
}else{
console.log(msgStr + 'compareCount: '+compareCount +' ,flag:'+flag);
}
console.log(msgStr+'compareCount: '+compareCount +' ,length: '+JSON.stringify(cloneColorArr.NBC.length)+ ' ,cloneColorArr.SBC:'+JSON.stringify(cloneColorArr.NBC));
console.log(msgStr+'compareCount: '+compareCount +' ,length: '+JSON.stringify(cloneColorArr.NCC.length)+' ,cloneColorArr.SCC'+JSON.stringify(cloneColorArr.NCC));
}
}
}
...
...
@@ -549,16 +632,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}
})
}
setTimeout(() => {
console.log(msgStr + 'time wait finished. compareCount: ' + compareCount);
listenerFlag = listenerStatus.finished;
let ca = cloneColorArr;
if (ca.NCC.length || ca.NBC.length || ca.SBC.length || ca.SCC.length) {
unexpectedError(null, caseName, ' something compaer failed', done);
} else {
done();
}
}, 10000)
})
})
})
...
...
@@ -586,7 +659,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let arrLength = systemBarData.regionTint.length;
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
if (tempData.type ===
2108 || tempData.type === 2112
) {
if (tempData.type ===
ohosWindow.WindowType.TYPE_STATUS_BAR || tempData.type === ohosWindow.WindowType.TYPE_NAVIGATION_BAR
) {
console.log(msgStr + 'systemBarTintChange compare start!');
compareCount++;
let backgroundIndex = cloneColorArr.indexOf(tempData.backgroundColor);
...
...
@@ -882,7 +955,8 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.getProperties true i: ' + i);
tempTypeArr.splice(tempTypeArr.findIndex(item => item === dataProper.type), 1);
console.log(msgStr + 'tempWnd.getProperties true tempTypeArr.length: ' + tempTypeArr.length);
console.log(msgStr + 'tempWnd.getProperties true loopCount1.length - i: ' + loopCount1.length - i);
console.log(msgStr + 'tempWnd.getProperties true loopCount1.length: ' + loopCount1.length);
console.log(msgStr + 'tempWnd.getProperties true tempTypeArr.length + 1: ' + tempTypeArr.length + 1);
expect((loopCount1.length - i) == (tempTypeArr.length + 1)).assertTrue();
if (i == loopCount1.length - 1) {
console.log(msgStr + 'tempWnd.getProperties i=' + i + ' , loopCount1.length-1==' + loopCount1.length);
...
...
@@ -902,7 +976,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
unexpectedError(err, caseName, 'ohosWindow.create', done);
}
})
})
/**
* @tc.number SUB_WINDOW_SETWINDOWTYPE_JSAPI_004
...
...
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
00bf9d2d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录