Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
422b7f8e
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看板
未验证
提交
422b7f8e
编写于
7月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4535 3.1release用例上库
Merge pull request !4535 from lihao345/OpenHarmony-3.1-Release
上级
502d5840
a9508089
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
1129 addition
and
0 deletion
+1129
-0
ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets
..._four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets
+9
-0
ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets
...three/entry/src/main/ets/MainAbility/pages/scrollCode.ets
+3
-0
ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
.../entry/src/main/ets/MainAbility/pages/loadingProgress.ets
+4
-0
ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets
.../main/ets/MainAbility/test/LoadingProgressJsunit.test.ets
+36
-0
ace/ace_ets_test/entry/src/main/config.json
ace/ace_ets_test/entry/src/main/config.json
+5
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets
...st/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets
+93
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/Common.ets
..._ets_test/entry/src/main/ets/MainAbility/pages/Common.ets
+134
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets
...s_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets
+37
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
...est/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
+40
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets
...test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets
+71
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/pluginComponent.ets
.../entry/src/main/ets/MainAbility/pages/pluginComponent.ets
+42
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets
...rc/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets
+82
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
...entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
+165
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets
...ry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets
+215
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets
...ts_test/entry/src/main/ets/MainAbility/test/List.test.ets
+10
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets
...src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets
+95
-0
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets
.../src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets
+88
-0
未找到文件。
ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets
浏览文件 @
422b7f8e
...
...
@@ -41,9 +41,18 @@ struct MouseEventExample {
if (event.button === MouseButton.Back) {
this.eventButton = 'Back'
}
if (event.button === MouseButton.Middle) {
this.eventButton = 'Middle'
}
if (event.button === MouseButton.Forward) {
this.eventButton = 'Forward'
}
if (event.button === MouseButton.None) {
this.eventButton = 'None'
}
if (event.event.action === MouseAction.Press) {
this.eventAction = 'Press'
}
if (event.event.action === MouseAction.Release) {
this.eventAction = 'Release'
}
...
...
ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets
浏览文件 @
422b7f8e
...
...
@@ -116,6 +116,9 @@ struct scrollCode {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
if (side==Edge.Middle) {
globalThis.sideMiddle = side;
}
console.info('To the edge')
})
.onScrollEnd(() => {
...
...
ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
浏览文件 @
422b7f8e
...
...
@@ -51,6 +51,10 @@ struct LoadingProgressExample {
.key('LP')
.height(this.loadingHeight)
.color(Color.Black)
Text(''+LoadingProgressStyle.Circular).width(100).height(60).fontSize(20).key('LPCircular')
Text(''+LoadingProgressStyle.Default).width(100).height(60).fontSize(20).key('LPDefault')
Text(''+LoadingProgressStyle.Orbital).width(100).height(60).fontSize(20).key('LPOrbital')
}.width('100%').margin({ top: 6 })
}
}
\ No newline at end of file
ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets
浏览文件 @
422b7f8e
...
...
@@ -109,5 +109,41 @@ export default function loadingProgressJsunit() {
console.info('testLoadingProgress_600 END');
done();
});
it('testLoadingProgress_700', 0, async function (done) {
console.info('[testLoadingProgress_700] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPOrbital');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_700 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Orbital.toString())
console.info('testLoadingProgress_700 END');
done();
});
it('testLoadingProgress_800', 0, async function (done) {
console.info('[testLoadingProgress_800] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPDefault');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_800 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Default.toString())
console.info('testLoadingProgress_800 END');
done();
});
it('testLoadingProgress_900', 0, async function (done) {
console.info('[testLoadingProgress_900] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPCircular');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_900 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Circular.toString())
console.info('testLoadingProgress_900 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/config.json
浏览文件 @
422b7f8e
...
...
@@ -68,9 +68,14 @@
"pages/Navigator"
,
"pages/Panel"
,
"pages/Row"
,
"pages/EnumsWeek"
,
"pages/ProgressPage"
,
"pages/SideBarPage"
,
"pages/Common"
,
"pages/Swiper"
,
"pages/Tab"
,
"pages/AlertDialog"
,
"pages/CheckboxGroup"
,
"pages/Prop"
,
"pages/Link"
,
"pages/AppStorage"
,
...
...
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets
0 → 100644
浏览文件 @
422b7f8e
import events_emitter from '@ohos.events.emitter';
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct CheckboxExample {
@State flagTest:boolean = false
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("scrollCode page state change called:" + JSON.stringify(eventData));
this.flagTest = eventData.data.stateChange;
console.info("scrollableValue:" + this.flagTest);
} else {
console.info("scrollCode page color not change called:" + JSON.stringify(eventData));
}
}
onPageShow(){
var stateChangeEvent = {
eventId: 1850,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Scroll() {
Column() {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
CheckboxGroup({group : 'checkboxGroup'})
.selectedColor(0xed6f21)
.onChange((itemName:CheckboxGroupResult) => {
console.info("TextPicker::dialogResult is" + JSON.stringify(itemName.status))
globalThis.status = itemName.status;
})
.key('CheckboxGroup')
Text('select all').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox1 change is' + value)
})
Text('Checkbox1').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox2', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox2 change is' + value)
})
.key('Checkbox2')
Text('Checkbox2').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox3', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox3 change is' + value)
})
Text('Checkbox3').fontSize(20)
}
}
}
}
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/Common.ets
0 → 100644
浏览文件 @
422b7f8e
import events_emitter from '@ohos.events.emitter';
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct CommonPage {
@State isEnable: boolean = true
@Styles pressedStyles() {
.backgroundColor("#ED6F21")
.borderRadius(10)
.borderStyle(BorderStyle.Dashed)
.borderWidth(2)
.borderColor("#33000000")
.width(120)
.height(30)
.opacity(1)
}
@Styles clickedStyles() {
.backgroundColor("#ffd23535")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#2a10d497")
.width(90)
.height(25)
.opacity(1)
}
@Styles normalStyles() {
.backgroundColor("#0A59F7")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#33000000")
.width(100)
.height(25)
.opacity(1)
}
build() {
Column({ space: 10 }) {
Button() {
Text('onKeyTab').fontSize(25).fontWeight(FontWeight.Bold)
}.margin({ top: 20 }).backgroundColor('#0D9FFB')
.onKeyEvent((event:KeyEvent) => {
globalThis.deviceId = event.deviceId;
globalThis.keyCode = event.keyCode;
globalThis.keySource = event.keySource;
globalThis.keyText = event.keyText;
globalThis.metaKey = event.metaKey;
console.info('keyEvent deviceId + ' +event.deviceId)
console.info('keyEvent keyCode : ' +event.keyCode)
console.info('keyEvent keySource : ' +event.keySource)
console.info('keyEvent keyText : ' +event.keyText)
console.info('keyEvent metaKey : ' +event.metaKey)
})
Text("normal")
.fontSize(14)
.fontColor(Color.White)
.opacity(0.5)
.stateStyles({
normal: this.normalStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
.key('normal')
Text("pressed")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Dotted)
.borderWidth(2)
.borderColor(Color.Red)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
.stateStyles({
pressed: this.pressedStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
.key('pressed')
Text(this.isEnable ? "effective" : "clicked")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor(Color.Gray)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
// .enabled(this.isEnable)
.stateStyles({
clicked: this.clickedStyles,
})
.onClick((event:ClickEvent) => {
console.info('globalPosition'+event.target.area.globalPosition.x)
console.info('globalPosition'+event.target.area.globalPosition.y)
globalThis.globalPositionX = event.target.area.globalPosition.x;
globalThis.globalPositionY = event.target.area.globalPosition.y;
this.isEnable = !this.isEnable
console.log(`${this.isEnable}`)
})
.textAlign(TextAlign.Center)
.key('clicked')
}
}
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets
0 → 100644
浏览文件 @
422b7f8e
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct EnumsWeek {
@State weekTime:Week = 0
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text(''+Week.Mon).width(100).height(60).fontSize(20).key('TextMon')
Text(''+Week.Thur).width(100).height(60).fontSize(20).key('TextThur')
Text(''+Week.Fri).width(100).height(60).fontSize(20).key('TextFri')
Text(''+Week.Sat).width(100).height(60).fontSize(20).key('TextSat')
Text(''+Edge.Middle).width(100).height(60).fontSize(20).key('TextMiddle')
Text(''+HoverEffect.Auto).width(100).height(60).fontSize(20).key('TextAuto')
Text(''+HoverEffect.None).width(100).height(60).fontSize(20).key('TextNone')
Text(''+HoverEffect.Highlight).width(100).height(60).fontSize(20).key('TextHighlight')
Text(''+HoverEffect.Scale).width(100).height(60).fontSize(20).key('TextScale')
}.height(400).padding({ left: 35, right: 35, top: 35 })
}
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app';
@Entry
@Component
struct ProgressPage {
aboutToAppear(){
console.log('start')
console.log('vc = '+app.getInfo().versionCode )
globalThis.versionCode = app.getInfo().versionCode;
}
build() {
Column({ space: 15 }) {
Text('ScaleRing Progress').fontSize(9).fontColor(0xCCCCCC).width('90%')
Row({ space: 40 }) {
Progress({ value: 20, total: 150, type: ProgressType.ScaleRing })
.color(Color.Grey).value(50).width(100)
.style({ strokeWidth: 15, scaleCount: 15, scaleWidth: 5 })
.key('progress')
}
}.width('100%').margin({ top: 30 })
}
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets
0 → 100644
浏览文件 @
422b7f8e
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct SideBarPage {
normalIcon : Resource = $rawfile('person.png')
selectedIcon: Resource = $rawfile('hand.png')
@State arr: number[] = [1, 2, 3]
@State current: number = 1
buttonStyle: ButtonStyle = {
left:30,
icons:{
shown: '显示',
hidden: '隐藏',
switching:'过程'
}
}
build() {
SideBarContainer(SideBarContainerType.Embed)
{
Column() {
ForEach(this.arr, (item, index) => {
Column({ space: 5 }) {
Image(this.current === item ? this.selectedIcon : this.normalIcon).width(64).height(64)
Text("Index0" + item)
.fontSize(25)
.fontColor(this.current === item ? '#0A59F7' : '#999')
.fontFamily('source-sans-pro,cursive,sans-serif')
}
.onClick(() => {
this.current = item
})
}, item => item)
}.width('100%')
.justifyContent(FlexAlign.SpaceEvenly)
.backgroundColor('#fc2efd42')
RowSplit() {
Column(){
Text('Split page one').fontSize(30)
}.justifyContent(FlexAlign.Center)
Column(){
Text('Split page two').fontSize(30)
}.justifyContent(FlexAlign.Center)
}.width('100%').backgroundColor('#ffd94444')
}
.key('sideBar')
.sideBarWidth(240)
.controlButton(this.buttonStyle)
.minSideBarWidth(210)
.maxSideBarWidth(260)
.onChange((value: boolean) => {
console.info('status:' + value)
})
}
}
\ No newline at end of file
ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/pluginComponent.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import pluginComponentManager from '@ohos.pluginComponent'
@Entry
@Component
struct pluginComponent {
private content: string = "pluginComponent Page";
@State isPlaying: boolean = false
onPageShow() {
console.info('pluginComponent page show called');
}
onBuildDone() {
console.info('pluginComponent page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
export default function checkboxGroupJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('CheckboxGroupTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/CheckboxGroup',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get CheckboxGroup state success " + JSON.stringify(pages));
if (!("CheckboxExample" == pages.name)) {
console.info("get CheckboxGroup state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push CheckboxGroup page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push CheckboxGroup page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("CheckboxGroup after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('checkboxGroupTest001', 0, async function (done) {
console.info('checkboxGroupTest001 START');
await sleep(1)
sendEventByKey("Checkbox2", 10, "")
await sleep(1)
let status = globalThis.status;
console.info("status : "+status)
expect(status).assertEqual(1)
console.info('checkboxGroupTest001 END');
done();
});
}
)
}
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function commonJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('CommonTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/Common',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get Common state success " + JSON.stringify(pages));
if (!("Common" == pages.name)) {
console.info("get Common state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push Common page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push Common page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("Common after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest001', 0, async function (done) {
console.info('commonTest001 START');
await sleep(1)
let keyEvent: KeyEvent = {
type: KeyType.Down,
keyCode: 2049,
keyText: 'tab',
keySource: 4,
deviceId: 2,
metaKey: 0
}
sendKeyEvent(keyEvent)
await sleep(1)
let deviceId = globalThis.deviceId;
let keyCode = globalThis.keyCode;
let keySource = globalThis.keySource;
let keyText = globalThis.keyText;
let metaKey = globalThis.metaKey;
console.log("deviceId : "+deviceId)
console.log("keyCode : "+keyCode)
console.log("keySource : "+keySource)
console.log("keyText : "+keyText)
console.log("metaKey : "+metaKey)
expect(deviceId).assertEqual(2)
expect(keyCode).assertEqual(2049)
expect(keySource).assertEqual(4)
expect(keyText).assertEqual('Unknown')
expect(metaKey).assertEqual(0)
console.info('commonTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest002', 0, async function (done) {
console.info('commonTest002 START');
let strJson = getInspectorByKey('normal');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('normal')
console.info('commonTest002 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest003', 0, async function (done) {
console.info('commonTest003 START');
await sleep(1)
let strJson = getInspectorByKey('pressed');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('pressed')
console.info('commonTest003 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest004', 0, async function (done) {
console.info('commonTest004 START');
await sleep(1)
sendEventByKey("clicked", 10, "")
await sleep(1)
let strJson = getInspectorByKey('clicked');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('clicked')
let globalPositionX = globalThis.globalPositionX;
let globalPositionY = globalThis.globalPositionY;
console.log("globalPositionX : "+globalPositionX)
expect(globalPositionX).assertEqual(16.333333333333332)
console.log("globalPositionY : "+globalPositionY)
expect(globalPositionY).assertEqual(169.33333333333334)
console.info('commonTest004 END');
done();
});
})
}
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function EnumsWeekJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('EnumsWeekTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/EnumsWeek',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get EnumsWeek state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get EnumsWeek state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push EnumsWeek page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push EnumsWeek page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("EnumsWeek after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest001', 0, async function (done) {
console.info('enumsWeekTest001 START');
let strJson = getInspectorByKey('TextMon');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('1')
console.info('enumsWeekTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest002', 0, async function (done) {
console.info('enumsWeekTest002 START');
let strJson = getInspectorByKey('TextThur');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('8')
console.info('enumsWeekTest002 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest003', 0, async function (done) {
console.info('enumsWeekTest003 START');
await sleep(1)
let strJson = getInspectorByKey('TextFri');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('16')
console.info('enumsWeekTest003 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest004', 0, async function (done) {
console.info('enumsWeekTest004 START');
let strJson = getInspectorByKey('TextSat');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('32')
console.info('enumsWeekTest004 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest005', 0, async function (done) {
console.info('enumsWeekTest005 START');
let strJson = getInspectorByKey('TextMiddle');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('5')
console.info('enumsWeekTest005 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest006', 0, async function (done) {
console.info('enumsWeekTest006 START');
let strJson = getInspectorByKey('TextAuto');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Auto.toString())
console.info('enumsWeekTest006 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest007', 0, async function (done) {
console.info('enumsWeekTest007 START');
let strJson = getInspectorByKey('TextNone');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.None.toString())
console.info('enumsWeekTest007 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest008', 0, async function (done) {
console.info('enumsWeekTest008 START');
let strJson = getInspectorByKey('TextHighlight');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Highlight.toString())
console.info('enumsWeekTest008 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest009', 0, async function (done) {
console.info('enumsWeekTest009 START');
let strJson = getInspectorByKey('TextScale');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Scale.toString())
console.info('enumsWeekTest009 END');
done();
});
})
}
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
422b7f8e
...
...
@@ -17,6 +17,11 @@ import appStorageJsunit from './AppStorageJsunit.test.ets';
import linkJsunit from './LinkJsunit.test.ets';
import propJsunit from './PropJsunit.test.ets';
import alphabetIndexerJsunit from './AlphabetIndexerJsunit.test.ets';
import checkboxGroupJsunit from './CheckboxGroupJsunit.test.ets';
import commonJsunit from './CommonJsunit.test.ets';
import enumsWeekJsunit from './EnumsWeekJsunit.test.ets';
import progressPageJsunit from './ProgressPageJsunit.test.ets';
import sideBarPageJsunit from './SideBarPageJsunit.test.ets';
import listJsunit from './ListJsunit.test.ets';
import tabJsunit from './TabJsunit.test.ets';
import swiperJsunit from './SwiperJsunit.test.ets';
...
...
@@ -29,6 +34,11 @@ import gridJsunit from './GridJsnuit.test.ets';
import videoJsunit from './VideoJsunit.test.ets';
export default function testsuite() {
alphabetIndexerJsunit()
checkboxGroupJsunit()
commonJsunit()
enumsWeekJsunit()
progressPageJsunit()
sideBarPageJsunit()
rowJsunit()
gridJsunit()
gridItemJsunit()
...
...
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function ProgressPageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('ProgressPageTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/ProgressPage',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get ProgressPage state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get ProgressPage state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push ProgressPage page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push ProgressPage page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("ProgressPage after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('progressPageTest001', 0, async function (done) {
console.info('progressPageTest001 START');
let strJson = getInspectorByKey('progress');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.style.scaleCount))
console.log(JSON.stringify(obj.$attrs.style.scaleWidth))
expect(obj.$attrs.style.scaleCount).assertEqual('15')
expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp')
console.info('progressPageTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('progressPageTest002', 0, async function (done) {
console.info('progressPageTest002 START');
let versionCode = globalThis.versionCode;
console.log('versionCode = '+versionCode )
expect(versionCode).assertEqual(1000000)
console.info('progressPageTest002 END');
done();
});
})
}
ace/ace_ets_test/entry/src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets
0 → 100644
浏览文件 @
422b7f8e
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function SideBarPageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('SideBarPageTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/SideBarPage',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get SideBarPage state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get SideBarPage state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push SideBarPage page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push SideBarPage page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("SideBarPage after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('sideBarPageTest001', 0, async function (done) {
console.info('sideBarPageTest001 START');
let strJson = getInspectorByKey('sideBar');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.controlButton))
let controlButton = JSON.parse(obj.$attrs.controlButton)
console.log(JSON.stringify(controlButton.controlButton.icon.shown))
console.log(JSON.stringify(controlButton.controlButton.icon.hidden))
console.log(JSON.stringify(controlButton.controlButton.icon.switching))
expect(controlButton.controlButton.icon.shown).assertEqual('显示')
expect(controlButton.controlButton.icon.hidden).assertEqual('隐藏')
expect(controlButton.controlButton.icon.switching).assertEqual('过程')
// expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp')
console.info('sideBarPageTest001 END');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录