Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
43bf0757
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,发现更多精彩内容 >>
未验证
提交
43bf0757
编写于
7月 05, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4085 补充窗口xts接口
Merge pull request !4085 from 华华小仙女/master
上级
b9d59d0e
35a3f06f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
13 deletion
+93
-13
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
+55
-10
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
...indowStage/entry/src/main/ets/test/windowPromise.test.ets
+36
-1
未找到文件。
graphic/windowStage/entry/src/main/ets/test/List.test.ets
浏览文件 @
43bf0757
...
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import windowPromiseTest from './windowPromise.test
.ets
'
import windowCallbackTest from './windowCallback.test
.ets
'
import windowPromiseTest from './windowPromise.test'
import windowCallbackTest from './windowCallback.test'
export default function testsuite(context, windowStage, abilityStorage) {
windowCallbackTest(context, windowStage, abilityStorage)
...
...
graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets
浏览文件 @
43bf0757
...
...
@@ -14,9 +14,9 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index"
import ohosWindow from '@ohos.window';
import display from '@ohos.display';
import screenManager from '@ohos.screen';
export default function windowCallbackTest(context, windowStage, abilityStorage) {
console.log('testets context: ' + JSON.stringify(context))
...
...
@@ -534,6 +534,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
NCC: JSON.parse(JSON.stringify(commonNUMBERColorArr))
};
let compareCount = 0;
let endNum = 0;
let listenerFlag = listenerStatus.ready;
console.log(msgStr + 'begin');
listenerData.on = true;
...
...
@@ -547,18 +548,22 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
for (let i = 0; i < arrLength; i++) {
let tempData = systemBarData.regionTint[i];
if (tempData.type === ohosWindow.WindowType.TYPE_STATUS_BAR) {
console.log(msgStr + 'systemBarTintChange compare start! arrLength= '+ arrLength);
console.log(msgStr + 'systemBarTintChange compare start! arrLength= '
+ arrLength);
compareCount++;
let backgroundIndex = cloneColorArr.SBC.indexOf(tempData.backgroundColor);
let contentColorIndex = cloneColorArr.SCC.indexOf(tempData.contentColor);
if (backgroundIndex >= 0) {
cloneColorArr.SBC.splice(backgroundIndex, 1);
}else{
console.log(msgStr + 'SBC tempData.backgroundColor:' + JSON.stringify(tempData.backgroundColor));
}
if (contentColorIndex >= 0) {
cloneColorArr.SCC.splice(contentColorIndex, 1);
}else{
console.log(msgStr + 'SCC tempData.contentColor:' + JSON.stringify(tempData.contentColor));
}
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));
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++;
...
...
@@ -566,21 +571,26 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
let contentColorIndex = cloneColorArr.NCC.indexOf(tempData.contentColor);
if (backgroundIndex >= 0) {
cloneColorArr.NBC.splice(backgroundIndex, 1);
} else {
console.log(msgStr + 'NBC tempData.backgroundColor:' + JSON.stringify(tempData.backgroundColor));
}
if (contentColorIndex >= 0) {
cloneColorArr.NCC.splice(contentColorIndex, 1);
} else {
console.log(msgStr + 'NCC tempData.contentColor:' + JSON.stringify(tempData.contentColor));
}
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);
if
(compareCount === 18 && !flag)
{
console.log(msgStr + 'compareCount: '
+ compareCount + ' ,true flag:' +
flag);
expect(true).assertTrue();
done();
}
else
{
console.log(msgStr + 'compareCount: '
+compareCount +' ,flag:'+
flag);
}
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));
console.log(msgStr + 'compareCount: ' + endNum + ' ,compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.NBC.length) + ' ,cloneColorArr.SBC:' + JSON.stringify(cloneColorArr.NBC));
console.log(msgStr + 'compareCount: ' + endNum + ' ,compareCount: ' + compareCount + ' ,length: ' + JSON.stringify(cloneColorArr.NCC.length) + ' ,cloneColorArr.SCC' + JSON.stringify(cloneColorArr.NCC));
endNum = compareCount
}
}
}
...
...
@@ -1405,5 +1415,40 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}
})
})
/**
* @tc.number SUB_WINDOW_SETSCREENROTATIONLOCKED_JSAPI_002
* @tc.name Test setScreenRotationLockedTest2
* @tc.desc Verify the scene of setting screen automatic screen rotation and locking
*/
it('setScreenRotationLockedTest2', 0, function (done) {
let caseName = 'setScreenRotationLockedTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
screenManager.setScreenRotationLocked(true, (err, data) => {
if (err && err.code)unexpectedError(err, caseName, 'screenManager.setScreenRotationLocked(true)', done);
console.log(msgStr + 'screenManager.setScreenRotationLocked err: ' + JSON.stringify(err));
console.log(msgStr + 'screenManager.setScreenRotationLocked true data: ' + JSON.stringify(data));
expect(!data).assertTrue();
screenManager.isScreenRotationLocked((err, data) => {
if (err && err.code)unexpectedError(err, caseName, 'screenManager.isScreenRotationLocked', done);
console.log(msgStr + 'screenManager.isLocked err: ' + JSON.stringify(err));
console.log(msgStr + 'data:' + data)
expect(data).assertTrue();
screenManager.setScreenRotationLocked(false, (err, data) => {
if (err && err.code)unexpectedError(err, caseName, 'screenManager.setScreenRotationLocked(false)', done);
console.log(msgStr + 'screenManager.setScreenRotationLocked err: ' + JSON.stringify(err));
console.log(msgStr + 'screenManager.setScreenRotationLocked true data: ' + JSON.stringify(data));
expect(!data).assertTrue();
screenManager.isScreenRotationLocked((err, data) => {
if (err && err.code)unexpectedError(err, caseName, 'screenManager.isScreenRotationLocked', done);
console.log(msgStr + 'screenManager.isLocked err: ' + JSON.stringify(err));
console.log(msgStr + 'data:' + data)
expect(!data).assertTrue();
done();
})
})
})
})
})
})
}
graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets
浏览文件 @
43bf0757
...
...
@@ -68,7 +68,7 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
beforeAll(function () {
console.log('jsunittest beforeall ohosWindow.WindowType=' + JSON.stringify(ohosWindow.WindowType));
systemWindowTypeDicArr = Object.keys(systemWindowTypeDic);
console.log('jsunittest beforeall systemWindowTypeDicArr=' + JSON.stringify(systemWindowTypeDicArr)
+' ,length='+
systemWindowTypeDicArr.length);
console.log('jsunittest beforeall systemWindowTypeDicArr=' + JSON.stringify(systemWindowTypeDicArr)
+ ' ,length=' +
systemWindowTypeDicArr.length);
systemWindowValueArr = Object.keys(systemWindowTypeDic);
systemWindowTypeArr = Object.keys(systemWindowTypeDic);
for (i in ohosWindow.WindowType) {
...
...
@@ -1350,5 +1350,40 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'done ');
done();
})
/**
* @tc.number SUB_WINDOW_SETSCREENROTATIONLOCKED_JSAPI_001
* @tc.name Test setScreenRotationLockedTest1
* @tc.desc Verify the scene of setting screen automatic screen rotation and locking
*/
it('setScreenRotationLockedTest1', 0, async function (done) {
let caseName = 'setScreenRotationLockedTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin');
let screens = await screenManager.setScreenRotationLocked(true).catch(err => {
unexpectedError(err, caseName, 'screenManager.setScreenRotationLocked(true)', done);
console.log(msgStr + 'screenManager.setScreenRotationLocked err: ' + JSON.stringify(err));
})
console.log(msgStr + 'screenManager.setScreenRotationLocked screens: ' + JSON.stringify(screens));
expect(!screens).assertTrue();
let isLocked = await screenManager.isScreenRotationLocked().catch(err => {
unexpectedError(err, caseName, 'screenManager.isScreenRotationLocked', done);
console.log(msgStr + 'screenManager.isLocked err: ' + JSON.stringify(err));
})
console.log(msgStr+'isLocked:'+isLocked)
expect(isLocked).assertTrue();
let screensFalse = await screenManager.setScreenRotationLocked(false).catch(err => {
unexpectedError(err, caseName, 'screenManager.setScreenRotationLocked(false)', done);
console.log(msgStr + 'screenManager.setScreenRotationLocked screensFalse err: ' + JSON.stringify(err));
})
console.log(msgStr + 'screenManager.setScreenRotationLocked screensFalse: ' + JSON.stringify(screensFalse));
expect(!screensFalse).assertTrue();
let isLockedFalse = await screenManager.isScreenRotationLocked().catch(err => {
unexpectedError(err, caseName, 'screenManager.isScreenRotationLocked isLockedFalse', done);
console.log(msgStr + 'screenManager.isLocked isLockedFalse err: ' + JSON.stringify(err));
})
console.log(msgStr+'isLockedFalse:'+isLockedFalse)
expect(!isLockedFalse).assertTrue();
done();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录