diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets index 1823f24f15d394e8037ef7cbfa67ffc6b90900ea..5c073174cbaaf6422291428a85912db0bb9a7330 100755 --- a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets @@ -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' } diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets index 0b6dd2fbb842a1ef22702268960a6330d28818ef..23c8037597a0374a171d70e02e81575e66ac3493 100755 --- a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets @@ -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(() => { diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets index b88b3a28122702469977ab5f71ef47d7b9cb757e..7ef93c2874763e038a4185de51d321d583ef2ccd 100755 --- a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets @@ -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 diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets index 4b2d53c5eba7a7cf2f0dd9f8f10bd4f4972deba3..acaa722ef2f112193e7f2596f4bf6df2ea68c808 100755 --- a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets @@ -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 diff --git a/ace/ace_ets_test/entry/src/main/config.json b/ace/ace_ets_test/entry/src/main/config.json index e1d876d5b315c68a331e7a0fd94fd3a7f1a1e0dd..677bdaaea62c31b929ea19b6a42f7713de78c6e4 100644 --- a/ace/ace_ets_test/entry/src/main/config.json +++ b/ace/ace_ets_test/entry/src/main/config.json @@ -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", diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b0ab44a2e423ae121e78868965f5de3c5821f2b --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/CheckboxGroup.ets @@ -0,0 +1,93 @@ +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 diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/Common.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/Common.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0b2d7644c0fec568de9451d8c2f397c1f996fa5 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/Common.ets @@ -0,0 +1,134 @@ +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 diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets new file mode 100644 index 0000000000000000000000000000000000000000..e713adcfaa1a4636945570e8bd90b578dcc1e2d7 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/EnumsWeek.ets @@ -0,0 +1,37 @@ +/** + * 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 diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/ProgressPage.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/ProgressPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f52367af75634f61ae46dae5856828353034bc6 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/ProgressPage.ets @@ -0,0 +1,40 @@ +/* + * 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 diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..97e927f80722a22847ef509761508056c91a7a18 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/SideBarPage.ets @@ -0,0 +1,71 @@ +/** + * 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 diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/pluginComponent.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/pluginComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..80fd9a79fbcf47bd790d26549a5b27d396f9f654 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/pages/pluginComponent.ets @@ -0,0 +1,42 @@ +/* + * 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%') + } +} diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..380345a81eadd6456f0902f7115d4f54b84fa29a --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets @@ -0,0 +1,82 @@ +/* + * 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(); + }); + } + + ) +} diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6874d151a729dcdc7e28e7f1bbc2ba00492674b9 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets @@ -0,0 +1,165 @@ +/* + * 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(); + }); + + + }) +} diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..327204f063e12ebb1d5f4431b637055865e0186d --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/EnumsWeekJsunit.test.ets @@ -0,0 +1,215 @@ +/* + * 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(); + }); + + + + }) +} diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets index 723bc8c8cc20d642f428e495e43a4c488e95abf3..0b3c01ca89f2b207298aa4dc8606a3e6510f06fe 100644 --- a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/List.test.ets @@ -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() diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc4f460113cfeb69b43f5c15b06ddfc0c88f51c7 --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/ProgressPageJsunit.test.ets @@ -0,0 +1,95 @@ +/* + * 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(); + }); + + + }) +} diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c106b8bdf62f7eead5368314a1446750230ff20e --- /dev/null +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/SideBarPageJsunit.test.ets @@ -0,0 +1,88 @@ +/* + * 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(); + }); + + + + + }) +}