diff --git a/arkui/ace_ets_component_apilack/entry/src/main/config.json b/arkui/ace_ets_component_apilack/entry/src/main/config.json index e2e2ae73347e795fb694dbbcb191cc89e437dc8d..219294cdc3f6bb10248f0c4272502911d7560cfe 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/config.json +++ b/arkui/ace_ets_component_apilack/entry/src/main/config.json @@ -71,12 +71,11 @@ "type": "pageAbility" }, "pages": [ + "pages/index", "pages/alphabetIndexer", - "pages/attr_animate", - "pages/bindContextMenu", "pages/checkBoxGroup", "pages/circle", - "pages/index" + "pages/ellipse" ], "name": ".MainAbility", "window": { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets index 77f9da39063944a6cbda5bc5a5e06d8fb11f9a0d..c34243b3384b18616165b3dcd3b1bc735ccf700f 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets @@ -15,6 +15,7 @@ import Log from '../common/Log.ets'; import prompt from '@ohos.prompt' +import events_emitter from '@ohos.events.emitter'; const TAG = 'ets_apiLack_add'; @Entry @@ -23,6 +24,8 @@ export default struct AlphabetIndexerOnSelect { private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'] private content: string = "AlphabetIndexer Page" + @State onSelectStatus: boolean = false; + @State onRequestPopupDataStatus: boolean = false; aboutToAppear() { Log.showInfo(TAG, `aboutToAppear AlphabetIndexerOnSelect start`) } @@ -40,63 +43,6 @@ struct AlphabetIndexerOnSelect { build(){ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ - - Text("alphabetIndexer-OnSelect") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("onSelectText") - - Text("alphabetIndexer-OnRequestPopupData") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("onRequestPopupDataText") - - Text("alphabetIndexer-OnPopupSelect") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("onPopupSelectText") - - Text("alphabetIndexer-PopupPosition") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("popupPositionText") - Text(`${this.content}`) .fontSize(20) .align(Alignment.Center) @@ -112,22 +58,56 @@ struct AlphabetIndexerOnSelect { .selectedFont({ size: 16, weight: FontWeight.Regular }) .popupFont({ size: 30, weight: FontWeight.Bolder, style: FontStyle.Normal }) .itemSize(28) + .width(100) + .height(300) .alignStyle(IndexerAlign.Left) .onSelect((index: number) => { console.info(this.value[index] + 'on onSelect') - this.showToast("onSelect() " + index); + this.showToast("onSelect() " + index) + this.onSelectStatus = true; + try { + var backData = { + data: { + "STATUS": this.onSelectStatus + } + } + let backEvent = { + eventId: 10201, + priority: events_emitter.EventPriority.LOW + } + console.info("onSelect start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onSelect emit action state err: " + JSON.stringify(err.message)) + } }) .onPopupSelect((index: number) => { console.info(this.value[index] + 'on onPopupSelect') - this.showToast("onPopupSelect() " + index); + this.showToast("onPopupSelect() " + index) }) .onRequestPopupData((index: number) => { console.info(this.value[index] + 'on onRequestPopupData') - this.showToast("onRequestPopupData() " + index); - return ['1','2','3','4','5']; + this.showToast("onRequestPopupData() " + index) + this.onRequestPopupDataStatus = true + try { + var backData = { + data: { + "STATUS": this.onRequestPopupDataStatus + } + } + let backEvent = { + eventId: 10202, + priority: events_emitter.EventPriority.LOW + } + console.info("onRequestPopupData start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onRequestPopupData emit action state err: " + JSON.stringify(err.message)) + } + return ['1', '2', '3', '4', '5'] + }) -// 这个地方发生crash Error message: is not callable -// .popupPosition({ x:100, y:200}) + // .popupPosition({ x:100, y:200}) }.width("100%").height("100%") } } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/attr_animate.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/attr_animate.ets deleted file mode 100644 index 61b57adde8f2d57ce901ad0ba7483cc6600a20f6..0000000000000000000000000000000000000000 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/attr_animate.ets +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 AttrAnimationExample { - scroller: Scroller = new Scroller() - @State widthSize: number = 200 - @State heightSize: number = 80 - @State flag: boolean = true - - @State widthSizeEaseOut: number = 200 - @State heightSizeEaseOut: number = 80 - @State flagEaseOut: boolean = true - - @State widthSizeFastOutSlowIn: number = 200 - @State heightSizeFastOutSlowIn: number = 80 - @State flagFastOutSlowIn: boolean = true - - @State widthSizeLinearOutSlowIn: number = 200 - @State heightSizeLinearOutSlowIn: number = 80 - @State flagLinearOutSlowIn: boolean = true - - @State widthSizeFastOutLinearIn: number = 200 - @State heightSizeFastOutLinearIn: number = 80 - @State flagFastOutLinearIn: boolean = true - - @State widthSizeExtremeDeceleration: number = 200 - @State heightSizeExtremeDeceleration: number = 80 - @State flagExtremeDeceleration: boolean = true - - @State widthSizeSharp: number = 200 - @State heightSizeSharp: number = 80 - @State flagSharp: boolean = true - - @State widthSizeRhythm: number = 200 - @State heightSizeRhythm: number = 80 - @State flagRhythm: boolean = true - - @State widthSizeSmooth: number = 200 - @State heightSizeSmooth: number = 80 - @State flagSmooth: boolean = true - - @State widthSizeFriction: number = 200 - @State heightSizeFriction: number = 80 - @State flagFriction: boolean = true - - build() { - Column() { - Scroll(this.scroller) { - Column() { - Button('Curve.EaseInOut') - .onClick((event: ClickEvent) => { - if (this.flag) { - this.widthSize = 100 - this.heightSize = 50 - } else { - this.widthSize = 200 - this.heightSize = 80 - } - this.flag = !this.flag - }) - .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) - .animation({ - duration: 2000, // 动画时长 - curve: Curve.EaseInOut, // 动画曲线 - delay: 500, // 动画延迟 - iterations: 1, // 播放次数 - playMode: PlayMode.Normal // 动画模式 - }) - - Button('Curve.EaseOut') - .onClick((event: ClickEvent) => { - if (this.flagEaseOut) { - this.widthSizeEaseOut = 100 - this.heightSizeEaseOut = 50 - } else { - this.widthSizeEaseOut = 200 - this.heightSizeEaseOut = 80 - } - this.flagEaseOut = !this.flagEaseOut - }) - .width(this.widthSizeEaseOut).height(this.heightSizeEaseOut).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.EaseOut, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.FastOutSlowIn') - .onClick((event: ClickEvent) => { - if (this.flagFastOutSlowIn) { - this.widthSizeFastOutSlowIn = 100 - this.heightSizeFastOutSlowIn = 50 - } else { - this.widthSizeFastOutSlowIn = 200 - this.heightSizeFastOutSlowIn = 80 - } - this.flagFastOutSlowIn = !this.flagFastOutSlowIn - }) - .width(this.widthSizeFastOutSlowIn).height(this.heightSizeFastOutSlowIn).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.FastOutSlowIn, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.LinearOutSlowIn') - .onClick((event: ClickEvent) => { - if (this.flagLinearOutSlowIn) { - this.widthSizeLinearOutSlowIn = 100 - this.heightSizeLinearOutSlowIn = 50 - } else { - this.widthSizeLinearOutSlowIn = 200 - this.heightSizeLinearOutSlowIn = 80 - } - this.flagLinearOutSlowIn = !this.flagLinearOutSlowIn - }) - .width(this.widthSizeLinearOutSlowIn).height(this.heightSizeLinearOutSlowIn).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.LinearOutSlowIn, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.FastOutLinearIn') - .onClick((event: ClickEvent) => { - if (this.flagFastOutLinearIn) { - this.widthSizeFastOutLinearIn = 100 - this.heightSizeFastOutLinearIn = 50 - } else { - this.widthSizeFastOutLinearIn = 200 - this.heightSizeFastOutLinearIn = 80 - } - this.flagFastOutLinearIn = !this.flagFastOutLinearIn - }) - .width(this.widthSizeFastOutLinearIn).height(this.heightSizeFastOutLinearIn).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.FastOutLinearIn, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.ExtremeDeceleration') - .onClick((event: ClickEvent) => { - if (this.flagExtremeDeceleration) { - this.widthSizeExtremeDeceleration = 100 - this.heightSizeExtremeDeceleration = 50 - } else { - this.widthSizeExtremeDeceleration = 200 - this.heightSizeExtremeDeceleration = 80 - } - this.flagExtremeDeceleration = !this.flagExtremeDeceleration - }) - .width(this.widthSizeExtremeDeceleration).height(this.heightSizeExtremeDeceleration).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.ExtremeDeceleration, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.Sharp') - .onClick((event: ClickEvent) => { - if (this.flagSharp) { - this.widthSizeSharp = 100 - this.heightSizeSharp = 50 - } else { - this.widthSizeSharp = 200 - this.heightSizeSharp = 80 - } - this.flagSharp = !this.flagSharp - }) - .width(this.widthSizeSharp).height(this.heightSizeSharp).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.Sharp, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.Rhythm') - .onClick((event: ClickEvent) => { - if (this.flagRhythm) { - this.widthSizeRhythm = 100 - this.heightSizeRhythm = 50 - } else { - this.widthSizeRhythm = 200 - this.heightSizeRhythm = 80 - } - this.flagRhythm = !this.flagRhythm - }) - .width(this.widthSizeRhythm).height(this.heightSizeRhythm).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.Rhythm, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.Smooth') - .onClick((event: ClickEvent) => { - if (this.flagSmooth) { - this.widthSizeSmooth = 100 - this.heightSizeSmooth = 50 - } else { - this.widthSizeSmooth = 200 - this.heightSizeSmooth = 80 - } - this.flagSmooth = !this.flagSmooth - }) - .width(this.widthSizeSmooth).height(this.heightSizeSmooth).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.Smooth, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - - Button('Curve.Friction') - .onClick((event: ClickEvent) => { - if (this.flagFriction) { - this.widthSizeFriction = 100 - this.heightSizeFriction = 50 - } else { - this.widthSizeFriction = 200 - this.heightSizeFriction = 80 - } - this.flagFriction = !this.flagFriction - }) - .width(this.widthSizeFriction).height(this.heightSizeFriction).backgroundColor(0x317aff) - .animation({ - duration: 2000, - curve: Curve.Friction, - delay: 500, - iterations: 1, - playMode: PlayMode.Normal - }) - }.width('100%') - } - .scrollable(ScrollDirection.Vertical) - .scrollBar(BarState.On) - .scrollBarColor(Color.Gray) - .scrollBarWidth(30) - .onScroll((xOffset: number, yOffset: number) => { - console.info(xOffset + ' ' + yOffset) - }) - .onScrollEdge((side: Edge) => { - console.info('To the edge') - }) - .onScrollEnd(() => { - console.info('Scroll Stop') - }) - }.width('100%').margin({ top: 5 }) - } -} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets index 9a6cba4251d6f3854ab238167281d30945a3b794..b7664906f92f9d23c3ee7eb297c23fcb2fd258b5 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets @@ -14,7 +14,7 @@ */ import prompt from '@ohos.prompt' - +import events_emitter from '@ohos.events.emitter'; import Log from '../common/Log.ets'; const TAG = 'ets_apiLack_add'; @@ -23,6 +23,26 @@ const TAG = 'ets_apiLack_add'; @Component export default struct CheckBoxGroupSelectAll { + @State isSelect: boolean = true; + + onPageShow() { + console.info('[CheckBoxGroup] page show called'); + var stateChangeEvent = { + eventId: 908, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[CheckBoxGroup] page stateChangCallBack"); + if (eventData != null) { + console.info("[CheckBoxGroup] page state change called:" + JSON.stringify(eventData)); + if (eventData.data.isSelect != null) { + this.isSelect = eventData.data.isSelect; + } + } + } aboutToAppear() { Log.showInfo(TAG, `aboutToAppear CheckBoxGroupSelectAll start`) @@ -57,33 +77,33 @@ struct CheckBoxGroupSelectAll { .key("selectAllText") Scroll() { - Column() { - CheckboxGroup({group : 'checkboxGroup'}) - .selectedColor(0xed6f21) - .key('CheckboxGroup') - .selectAll(true) - .onChange((itemName:CheckboxGroupResult) => { - console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) - this.showToast(itemName.status.valueOf() == 0 ? "selectAll true" : "selectAll false"); - }) - Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox1 change is' + value) - }) - Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox2 change is' + value) - }) - Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox3 change is' + value) - }) + Column() { + CheckboxGroup({group : 'checkboxGroup'}) + .selectedColor(0xed6f21) + .key('CheckboxGroup') + .selectAll(this.isSelect) + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + this.showToast(itemName.status.valueOf() == 0 ? "selectAll true" : "selectAll false"); + }) + Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox1 change is' + value) + }) + Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is' + value) + }) + Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox3 change is' + value) + }) + } } - } - + }.width("100%").height("100%") } } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets index cd050ac67febfa71b2b8132e9c94e00af9b2dc54..4e3c3b5bf31b87abea5423dd2741db1675b86eec 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets @@ -21,7 +21,7 @@ const TAG = 'ets_apiLack_add'; export default struct CircleNe { @State w: string = "100px"; - @State h: string = "200px"; + @State h: string = "100px"; aboutToAppear() { Log.showInfo(TAG, `aboutToAppear CircleNew start`) } @@ -33,7 +33,7 @@ struct CircleNe { build(){ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ - Text("circle-Ne") + Text("circle-New") .width(100) .height(70) .fontSize(20) @@ -46,9 +46,6 @@ struct CircleNe { .textAlign(TextAlign.Center) .textOverflow({ overflow: TextOverflow.None }) .key("neText") - // .onSelect((index: number) => { - // console.info(this.value[index] + 'on onSelect') - // }) Circle() .width(`${this.w}`) diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.ets similarity index 51% rename from arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets rename to arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.ets index 2e899c2171286cda8c24a4d6805c79468554f1db..42183cb86929d4e6e19f9f0ac2993f226606ba9b 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.ets @@ -14,31 +14,40 @@ */ import Log from '../common/Log.ets'; - const TAG = 'ets_apiLack_add'; @Entry @Component -struct MenuExample { - // @State responseType: ResponseType = RightClick; +export default +struct EllipseNe { + @State w: string = "300.00px"; + @State h: string = "300.00px"; + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear EllipseNe start`) + } - @Builder ContextMenuBuilder() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Text('text3') - .fontSize(20) - .width(100) - .height(50) - .textAlign(TextAlign.Center) - Divider().height(10) - } + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear EllipseNe end`) } - build() { - Column() { - Text('click for menu') - } - .width('100%') - .margin({ top: 5 }) - //.bindContextMenu(this.ContextMenuBuilder(),this.responseType) + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("ellipse-Ne") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("neText") + Ellipse().width(`${this.w}`).height(`${this.h}`).key('ellipse') + }.width('100%').height('100%') } } + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets index 1ab477cbcaaf84034d442df07e7f340dc8dde8b1..3073a9643a3c23d4d937ffd06482fd9a1ffabb6d 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets @@ -15,10 +15,12 @@ import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets'; import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets'; -import circleNeJsunit from './circle.test.ets'; +import circleNewJsunit from './circle.test.ets'; +import ellipseNeJsunit from './ellipse.test.ets'; export default function testsuite() { alphabetIndexerOnSelectJsunit() checkBoxGroupSelectAllJsunit() - circleNeJsunit() + circleNewJsunit() + ellipseNeJsunit() } \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets index 83d8a3ec5e9aaab87068fcf2978132b44bc3f8c8..bbc074969f48aa339de681b5d38939b450a73aad 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets @@ -14,191 +14,250 @@ */ import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import Utils from './Utils.ets' export default function alphabetIndexerOnSelectJsunit() { describe('alphabetIndexerOnSelectTest', function () { - - /** - * run before testcase - */ beforeAll(async function (done) { - console.info('[alphabetIndexerOnSelectTest] before each called') - - let result; + console.info("flex beforeEach start"); let options = { - uri: 'pages/alphabetIndexer' + uri: 'pages/alphabetIndexer', } try { - result = router.push(options) - console.info("push alphabetIndexerOnSelectTest page success " + JSON.stringify(result)); + router.clear(); + let pages = router.getState(); + console.info("get alphabetIndexer state success " + JSON.stringify(pages)); + if (!("alphabetIndexer" == pages.name)) { + console.info("get alphabetIndexer state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push alphabetIndexer page success " + JSON.stringify(result)); + } } catch (err) { - console.error("push alphabetIndexerOnSelectTest page error " + JSON.stringify(result)); + console.error("push alphabetIndexer page error: " + err); } - await Utils.sleep(4000) done() }); - /** - * run after testcase - */ - afterAll(async function () { - console.info('[alphabetIndexerOnSelectTest] after each called') - await Utils.sleep(1000) + afterEach(async function () { + await Utils.sleep(1000); + console.info("alphabetIndexerOnSelect after each called"); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0001 - * @tc.name testalphabetIndexerOnSelect0001 - * @tc.desic acealphabetIndexerOnSelectEtsTest0001 + * @tc.name testalphabetIndexer0001 + * @tc.desic acealphabetIndexerEtsTest0001 */ - it('testalphabetIndexerOnSelect0001', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0001 START'); + it('testalphabetIndexerWidth0001', 0, async function (done) { + console.info('alphabetIndexerWidth testalphabetIndexerWidth0001 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0001] component width strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerWidth0001] component width strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); + expect(obj.$type).assertEqual('AlphabetIndexer'); expect(obj.$attrs.width).assertEqual("100.00vp"); - console.info("[testalphabetIndexerOnSelect0001] width value :" + obj.$attrs.width); + console.info("[testalphabetIndexerWidth0001] width value :" + obj.$attrs.width); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0002 - * @tc.name testalphabetIndexerOnSelect0002 - * @tc.desic acealphabetIndexerOnSelectEtsTest0002 + * @tc.name testalphabetIndexer0002 + * @tc.desic acealphabetIndexerEtsTest0002 */ - it('testalphabetIndexerOnSelect0002', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0002 START'); + it('testalphabetIndexerHeight0002', 0, async function (done) { + console.info('alphabetIndexerHeight testalphabetIndexerHeight0002 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0002] component height strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerHeight0002] component height strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.height).assertEqual("70.00vp"); - console.info("[testalphabetIndexerOnSelect0002] height value :" + obj.$attrs.height); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.height).assertEqual("300.00vp"); + console.info("[testalphabetIndexerHeight0002] height value :" + obj.$attrs.height); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0003 - * @tc.name testalphabetIndexerOnSelect0003 - * @tc.desic acealphabetIndexerOnSelectEtsTest0003 + * @tc.name testalphabetIndexer0003 + * @tc.desic acealphabetIndexerEtsTest0003 */ - it('testalphabetIndexerOnSelect0003', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0003 START'); + it('testalphabetIndexerColor0003', 0, async function (done) { + console.info('alphabetIndexerColor testalphabetIndexerColor0003 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0003] component fontSize strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerColor0003] component fontSize strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontSize).assertEqual("20.00fp"); - console.info("[testalphabetIndexerOnSelect0003] fontSize value :" + obj.$attrs.fontSize); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.color).assertEqual(undefined); + console.info("[testalphabetIndexerColor0003] color value :" + obj.$attrs.color); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0004 - * @tc.name testalphabetIndexerOnSelect0004 - * @tc.desic acealphabetIndexerOnSelectEtsTest0004 + * @tc.name testalphabetIndexer0004 + * @tc.desic acealphabetIndexerEtsTest0004 */ - it('testalphabetIndexerOnSelect0004', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0004 START'); + it('testalphabetIndexerSelectedColor0004', 0, async function (done) { + console.info('alphabetIndexerSelectedColor testalphabetIndexerSelectedColor0004 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); + let strJson = getInspectorByKey('alphabetIndexer'); console.info("[testalphabetIndexerOnSelect0004] component opacity strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.opacity).assertEqual(1); - console.info("[testalphabetIndexerOnSelect0004] opacity value :" + obj.$attrs.opacity); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.selectedColor).assertEqual("#FFFFFFFF"); + console.info("[testalphabetIndexerSelectedColor0004] selectedColor value :" + obj.$attrs.selectedColor); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0005 - * @tc.name testalphabetIndexerOnSelect0005 - * @tc.desic acealphabetIndexerOnSelectEtsTest0005 + * @tc.name testalphabetIndexer0005 + * @tc.desic acealphabetIndexerEtsTest0005 */ - it('testalphabetIndexerOnSelect0005', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0005 START'); + it('testalphabetIndexerPopupColor0005', 0, async function (done) { + console.info('alphabetIndexerPopupColor testalphabetIndexerPopupColor0005 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0005] component align strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerPopupColor0005] component align strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); - console.info("[testalphabetIndexerOnSelect0005] align value :" + obj.$attrs.align); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.popupColor).assertEqual("#FF48D1CC"); + console.info("[testalphabetIndexerPopupColor0005] popupColor value :" + obj.$attrs.popupColor); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0006 - * @tc.name testalphabetIndexerOnSelect0006 - * @tc.desic acealphabetIndexerOnSelectEtsTest0006 + * @tc.name testalphabetIndexer0006 + * @tc.desic acealphabetIndexerEtsTest0006 */ - it('testalphabetIndexerOnSelect0006', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0006 START'); + it('testalphabetIndexerSelectedBackgroundColor0006', 0, async function (done) { + console.info('alphabetIndexerSelectedBackgroundColor testalphabetIndexerSelectedBackgroundColor0006 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0006] component fontColor strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerSelectedBackgroundColor0006] component fontColor strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); - console.info("[testalphabetIndexerOnSelect0006] fontColor value :" + obj.$attrs.fontColor); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.selectedBackgroundColor).assertEqual("#FF0000E6"); + console.info("[testalphabetIndexerSelectedBackgroundColor0006] selectedBackgroundColor value :" + obj.$attrs.selectedBackgroundColor); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0007 - * @tc.name testalphabetIndexerOnSelect0007 - * @tc.desic acealphabetIndexerOnSelectEtsTest0007 + * @tc.name testalphabetIndexer0007 + * @tc.desic acealphabetIndexerEtsTest0007 */ - it('testalphabetIndexerOnSelect0007', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0007 START'); + it('testalphabetIndexerPopupBackground0007', 0, async function (done) { + console.info('alphabetIndexerPopupBackground testalphabetIndexerPopupBackground0007 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0007] component lineHeight strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerPopupBackground0007] component lineHeight strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); - console.info("[testalphabetIndexerOnSelect0007] lineHeight value :" + obj.$attrs.lineHeight); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.popupBackground).assertEqual("#E500DDDD"); + console.info("[testalphabetIndexerPopupBackground0007] popupBackground value :" + obj.$attrs.popupBackground); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0009 - * @tc.name testalphabetIndexerOnSelect0009 - * @tc.desic acealphabetIndexerOnSelectEtsTest0009 + * @tc.name testalphabetIndexer0009 + * @tc.desic acealphabetIndexerEtsTest0009 + */ + it('testalphabetIndexerUsingPopup0009', 0, async function (done) { + console.info('alphabetIndexerUsingPopup testalphabetIndexerUsingPopup009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerUsingPopup0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.usingPopup).assertEqual(true); + console.info("[testalphabetIndexerUsingPopup0009] usingPopup value :" + obj.$attrs.usingPopup); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testalphabetIndexer0010 + * @tc.desic acealphabetIndexerEtsTest0010 */ - it('testalphabetIndexerOnSelect0009', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect009 START'); + it('testalphabetIndexerItemSize0010', 0, async function (done) { + console.info('alphabetIndexerItemSize testalphabetIndexerItemSize0010 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0009] component padding strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerItemSize0010] component textAlign strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.padding).assertEqual("10.00vp"); - console.info("[testalphabetIndexerOnSelect0009] padding value :" + obj.$attrs.padding); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.itemSize).assertEqual("28.000000"); + console.info("[testalphabetIndexerItemSize0010] itemSize value :" + obj.$attrs.itemSize); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0010 - * @tc.name testalphabetIndexerOnSelect0010 - * @tc.desic acealphabetIndexerOnSelectEtsTest0010 + * @tc.name testalphabetIndexer0011 + * @tc.desic acealphabetIndexerEtsTest0011 */ - it('testalphabetIndexerOnSelect0010', 0, async function (done) { - console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0010 START'); + it('testalphabetIndexerAlignStyle0011', 0, async function (done) { + console.info('alphabetIndexerAlignStyle testalphabetIndexerAlignStyle0011 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('onSelectText'); - console.info("[testalphabetIndexerOnSelect0010] component textAlign strJson:" + strJson); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerAlignStyle0011] component strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); - console.info("[testalphabetIndexerOnSelect0010] textAlign value :" + obj.$attrs.textAlign); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.alignStyle).assertEqual("AlignStyle.Left"); + console.info("[testalphabetIndexerItemSize0010] alignStyle value :" + obj.$attrs.alignStyle); done(); }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testalphabetIndexerOnSelect0012 + * @tc.desic acealphabetIndexerOnSelectEtsTest0012 + */ + it('testalphabetIndexerOnSelect0012', 0, async function (done) { + console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0011 START'); + await Utils.sleep(2000); + try{ + let callback = (indexEvent) => { + console.info("onSelect_0012 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(true); + } + let indexEvent = { + eventId: 10201, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('alphabetIndexer', 10, "") + events_emitter.on(indexEvent, callback); + }catch(err){ + console.info("onSelect_0012 on events_emitter err : " + JSON.stringify(err)); + } + + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 10202, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + sendEventByKey('alphabetIndexer', 10, "") + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('alphabetIndexer', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testalphabetIndexerOnSelect0012 END'); + done(); + + }); }) } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets index a49e079381cb573c4f70a4c5b22f8a0593789a93..dc7297b94dfb97d92e01b5a06e3cf39a56ff180e 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import events_emitter from '@ohos.events.emitter'; import router from '@system.router'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import Utils from './Utils.ets' @@ -53,12 +54,12 @@ export default function checkBoxGroupSelectAllJsunit() { it('testcheckBoxGroupSelectAll0001', 0, async function (done) { console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0001 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0001] component width strJson:" + strJson); + let strJson = getInspectorByKey('CheckboxGroup'); + console.info("[testcheckBoxGroupSelectAll0001] component selectedColor strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.width).assertEqual("100.00vp"); - console.info("[testcheckBoxGroupSelectAll0001] width value :" + obj.$attrs.width); + expect(obj.$type).assertEqual('CheckboxGroup'); + expect(obj.$attrs.selectedColor).assertEqual("#FFED6F21"); + console.info("[testcheckBoxGroupSelectAll0001] selectedColor value :" + obj.$attrs.selectedColor); done(); }); @@ -69,132 +70,28 @@ export default function checkBoxGroupSelectAllJsunit() { */ it('testcheckBoxGroupSelectAll0002', 0, async function (done) { console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0002 START'); + try { + var eventData = { + data: { + "isSelect": false + } + } + var innerEvent = { + eventId: 908, + priority: events_emitter.EventPriority.LOW + } + console.info("[testcheckBoxGroupSelectAll0002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testcheckBoxGroupSelectAll0002] change component data error: " + err.message); + } await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0002] component height strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.height).assertEqual("70.00vp"); - console.info("[testcheckBoxGroupSelectAll0002] height value :" + obj.$attrs.height); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0003 - * @tc.name testcheckBoxGroupSelectAll0003 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0003 - */ - it('testcheckBoxGroupSelectAll0003', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0003 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0003] component fontSize strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontSize).assertEqual("20.00fp"); - console.info("[testcheckBoxGroupSelectAll0003] fontSize value :" + obj.$attrs.fontSize); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0004 - * @tc.name testcheckBoxGroupSelectAll0004 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0004 - */ - it('testcheckBoxGroupSelectAll0004', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0004 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0004] component opacity strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.opacity).assertEqual(1); - console.info("[testcheckBoxGroupSelectAll0004] opacity value :" + obj.$attrs.opacity); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0005 - * @tc.name testcheckBoxGroupSelectAll0005 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0005 - */ - it('testcheckBoxGroupSelectAll0005', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0005 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0005] component align strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); - console.info("[testcheckBoxGroupSelectAll0005] align value :" + obj.$attrs.align); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0006 - * @tc.name testcheckBoxGroupSelectAll0006 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0006 - */ - it('testcheckBoxGroupSelectAll0006', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0006 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0006] component fontColor strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); - console.info("[testcheckBoxGroupSelectAll0006] fontColor value :" + obj.$attrs.fontColor); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0007 - * @tc.name testcheckBoxGroupSelectAll0007 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0007 - */ - it('testcheckBoxGroupSelectAll0007', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0007 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0007] component lineHeight strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); - console.info("[testcheckBoxGroupSelectAll0007] lineHeight value :" + obj.$attrs.lineHeight); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0009 - * @tc.name testcheckBoxGroupSelectAll0009 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0009 - */ - it('testcheckBoxGroupSelectAll0009', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll009 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0009] component padding strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.padding).assertEqual("10.00vp"); - console.info("[testcheckBoxGroupSelectAll0009] padding value :" + obj.$attrs.padding); - done(); - }); - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0010 - * @tc.name testcheckBoxGroupSelectAll0010 - * @tc.desic acecheckBoxGroupSelectAllEtsTest0010 - */ - it('testcheckBoxGroupSelectAll0010', 0, async function (done) { - console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0010 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('selectAllText'); - console.info("[testcheckBoxGroupSelectAll0010] component textAlign strJson:" + strJson); + let strJson = getInspectorByKey('CheckboxGroup'); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); - console.info("[testcheckBoxGroupSelectAll0010] textAlign value :" + obj.$attrs.textAlign); + console.info("[testcheckBoxGroupSelectAll0002] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.selectAll).assertEqual('false'); + console.info('testcheckBoxGroupSelectAll0002 END'); done(); }); }) diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets index 47fc946872ba86cdca03baa99adaf728221ecd8e..8103bd827ba1ad14121dfb88edc8957dc26c99d9 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets @@ -17,10 +17,10 @@ import router from '@system.router'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import Utils from './Utils.ets' -export default function circleNeJsunit() { - describe('circleNeTest', function () { +export default function circleNewJsunit() { + describe('circleNewTest', function () { beforeAll(async function (done) { - console.info("flex beforeEach start"); + console.info("circle beforeEach start"); let options = { uri: 'pages/circle', } @@ -42,176 +42,40 @@ export default function circleNeJsunit() { afterEach(async function () { await Utils.sleep(1000); - console.info("circleNe after each called"); + console.info("circleNew after each called"); }); /* - * @tc.number SUB_ACE_BASIC_ETS_API_0001 - * @tc.name testcircleNe0001 - * @tc.desic acecircleNeEtsTest0001 + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testcircleNew001 + * @tc.desic acecircleNewEtsTest001 */ - it('testcircleNe0001', 0, async function (done) { - console.info('circleNe testcircleNe0001 START'); + it('testcircleNew001', 0, async function (done) { + console.info('circleNew testcircleNew0011 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0001] component width strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.width).assertEqual("100.00vp"); - console.info("[testcircleNe0001] width value :" + obj.$attrs.width); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0002 - * @tc.name testcircleNe0002 - * @tc.desic acecircleNeEtsTest0002 - */ - it('testcircleNe0002', 0, async function (done) { - console.info('circleNe testcircleNe0002 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0002] component height strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.height).assertEqual("70.00vp"); - console.info("[testcircleNe0002] height value :" + obj.$attrs.height); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0003 - * @tc.name testcircleNe0003 - * @tc.desic acecircleNeEtsTest0003 - */ - it('testcircleNe0003', 0, async function (done) { - console.info('circleNe testcircleNe0003 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0003] component fontSize strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontSize).assertEqual("20.00fp"); - console.info("[testcircleNe0003] fontSize value :" + obj.$attrs.fontSize); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0004 - * @tc.name testcircleNe0004 - * @tc.desic acecircleNeEtsTest0004 - */ - it('testcircleNe0004', 0, async function (done) { - console.info('circleNe testcircleNe0004 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0004] component opacity strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.opacity).assertEqual(1); - console.info("[testcircleNe0004] opacity value :" + obj.$attrs.opacity); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0005 - * @tc.name testcircleNe0005 - * @tc.desic acecircleNeEtsTest0005 - */ - it('testcircleNe0005', 0, async function (done) { - console.info('circleNe testcircleNe0005 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0005] component align strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); - console.info("[testcircleNe0005] align value :" + obj.$attrs.align); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0006 - * @tc.name testcircleNe0006 - * @tc.desic acecircleNeEtsTest0006 - */ - it('testcircleNe0006', 0, async function (done) { - console.info('circleNe testcircleNe0006 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0006] component fontColor strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); - console.info("[testcircleNe0006] fontColor value :" + obj.$attrs.fontColor); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0007 - * @tc.name testcircleNe0007 - * @tc.desic acecircleNeEtsTest0007 - */ - it('testcircleNe0007', 0, async function (done) { - console.info('circleNe testcircleNe0007 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0007] component lineHeight strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); - console.info("[testcircleNe0007] lineHeight value :" + obj.$attrs.lineHeight); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0009 - * @tc.name testcircleNe0009 - * @tc.desic acecircleNeEtsTest0009 - */ - it('testcircleNe0009', 0, async function (done) { - console.info('circleNe testcircleNe009 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0009] component padding strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.padding).assertEqual("10.00vp"); - console.info("[testcircleNe0009] padding value :" + obj.$attrs.padding); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0010 - * @tc.name testcircleNe0010 - * @tc.desic acecircleNeEtsTest0010 - */ - it('testcircleNe0010', 0, async function (done) { - console.info('circleNe testcircleNe0010 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('neText'); - console.info("[testcircleNe0010] component textAlign strJson:" + strJson); + let strJson = getInspectorByKey('circle'); + console.info("[testcircleNew001] component textAlign strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); - console.info("[testcircleNe0010] textAlign value :" + obj.$attrs.textAlign); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("100.00px"); + console.info("[testcircleNew001] width value :" + obj.$attrs.width); done(); }); /* - * @tc.number SUB_ACE_BASIC_ETS_API_0011 - * @tc.name testcircleNe0011 - * @tc.desic acecircleNeEtsTest0011 + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name testcircleNew002 + * @tc.desic acecircleNewEtsTest002 */ - it('testcircleNe0011', 0, async function (done) { - console.info('circleNe testcircleNe0011 START'); + it('testcircleNew002', 0, async function (done) { + console.info('circleNew testcircleNew002 START'); await Utils.sleep(2000); let strJson = getInspectorByKey('circle'); - console.info("[testcircleNe0011] component textAlign strJson:" + strJson); + console.info("[testcircleNew002] component textAlign strJson:" + strJson); let obj = JSON.parse(strJson); expect(obj.$type).assertEqual('Shape'); - expect(obj.$attrs.width).assertEqual("100.00px"); - console.info("[testcircleNe0011] width value :" + obj.$attrs.width); + expect(obj.$attrs.height).assertEqual("100.00px"); + console.info("[testcircleNew002] width value :" + obj.$attrs.width); done(); }); }) diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0ec74a398c381554af21da2acf80478d6f98616 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function ellipseNeJsunit() { + describe('ellipseNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/ellipse', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get ellipse state success " + JSON.stringify(pages)); + if (!("ellipse" == pages.name)) { + console.info("get ellipse state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push ellipse page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ellipse page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ellipseNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testellipseNe0001 + * @tc.desic aceellipseNeEtsTest0001 + */ + it('testellipseNe0001', 0, async function (done) { + console.info('ellipseNe testellipseNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ellipse'); + console.info("[testellipseNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("300.00px"); + console.info("[testellipseNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testellipseNe0002 + * @tc.desic aceellipseNeEtsTest0002 + */ + it('testellipseNe0002', 0, async function (done) { + console.info('ellipseNe testellipseNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ellipse'); + console.info("[testellipseNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("300.00px"); + console.info("[testellipseNe0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/local.properties b/local.properties new file mode 100644 index 0000000000000000000000000000000000000000..2f915f6a201447f7a48d56d2b93ba2e29c475fe1 --- /dev/null +++ b/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by DevEco Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file should *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# For customization when using a Version Control System, please read the header note. +sdk.dir=D:/beta3Sdk +nodejs.dir=D:/software/DevEco Studio 3.0.0.900/tools/nodejs +npm.dir=D:/software/DevEco Studio 3.0.0.900/tools/nodejs \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..48e341a0954d5f8c2accf3a6731be28e5bb9c0de --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +}