diff --git a/ace/BUILD.gn b/ace/BUILD.gn index 543828be2ade81485903d644fa3603af3ce7bbac..b3b80f9585651e985a60f1024c520f560bc84168 100755 --- a/ace/BUILD.gn +++ b/ace/BUILD.gn @@ -9,13 +9,16 @@ # 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. +# limitations under the License. group("ace") { testonly = true deps = [ "ace_ets_component:AceEtsComponentTest", - "ace_ets_component:AceEtsComponentTest", + "ace_ets_component_five:AceEtsComponentFiveTest", + "ace_ets_component_four:AceEtsComponentFourTest", + "ace_ets_component_three:AceEtsComponentThreeTest", + "ace_ets_component_two:AceEtsComponentTwoTest", "ace_ets_standard:ActsAceEtsStTest", "ace_ets_test:ActsAceEtsTest", "ace_ets_third_test:ActsAceEtsThirdTest", diff --git a/ace/ace_ets_component/BUILD.gn b/ace/ace_ets_component/BUILD.gn index ecfc7942d2d6b74ee7ec1e82da1a1d0bd369bd88..06ccf03c13ffae62d23131dc313c41c4c9b2202f 100755 --- a/ace/ace_ets_component/BUILD.gn +++ b/ace/ace_ets_component/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ace/ace_ets_component/entry/src/main/config.json b/ace/ace_ets_component/entry/src/main/config.json index 46473a4a717afab474cacd94f35393f46771f0c2..20fdb9a8d8600303d7381f7ffcad58e9b4df38e5 100755 --- a/ace/ace_ets_component/entry/src/main/config.json +++ b/ace/ace_ets_component/entry/src/main/config.json @@ -59,149 +59,27 @@ }, "pages": [ "pages/index", - "pages/toggle", - "pages/actionSheet", - "pages/gauge", + "pages/appear", + "pages/areaChange", "pages/ellipse", - "pages/systemRouterA", - "pages/systemRouterB", - "pages/marquee", - "pages/stepper", - "pages/list", - "pages/general-properties/sizeSetting", - "pages/general-properties/positionSetting", - "pages/general-properties/shapeClipping", - "pages/general-properties/opacitySetting", - "pages/swiper", "pages/enable", - "pages/general-properties/clickEvent", - "pages/general-properties/layoutConstraints", - "pages/general-properties/colorGradient", - "pages/areaChange", - "pages/general-properties/textStyle", - "pages/appear", + "pages/flex", + "pages/gauge", + "pages/global", + "pages/gridContainer", + "pages/gridSettings", + "pages/imageEffects", + "pages/layoutConstraints", + "pages/list", + "pages/marquee", "pages/overlay", - "pages/general-properties/visibility", - "pages/zIndex", - "pages/general-properties/touchAble", - "pages/general-properties/imageEffects", - "pages/general-properties/transForm", - "pages/general-properties/touchAble", - "pages/general-properties/gridSettings", - "pages/general-properties/touch", - "pages/general-properties/border", - "pages/general-properties/flex", - "pages/swiper", - "pages/gridPage", - "pages/span", - "pages/text", - "pages/badge", - "pages/canvas", - "pages/longPressGesture", - "pages/badge", - "pages/button", - "pages/gridPage", - "pages/general-properties/touchAble", + "pages/stepper", "pages/swiper", - "pages/general-properties/visibility", - "pages/general-properties/ResponseRegion", - "pages/general-properties/PanGesture", - "pages/QrCode", - "pages/tabs", - "pages/tapGesture", - "pages/progress", - "pages/animate", - "pages/column", - "pages/rating", - "pages/canvas2", - "pages/shape", - "pages/motionPath", - "pages/scrollCode", - "pages/transition", - "pages/priorityGesture", - "pages/parallelGesture", - "pages/alertDialog", - "pages/blank", - "pages/sharedTransition", - "pages/sharedTransition2", - "pages/alphabetIndexer", - "pages/line", - "pages/circle", - "pages/aboutToDisappear", - "pages/timeStamp", - "pages/bindMenu", - "pages/bindPopup", - "pages/gridContainer", - "pages/direction", - "pages/divider", - "pages/listItem", - "pages/systemPrompt", - "pages/configuration", - "pages/sourceType", - "pages/NavigatorBackCode", - "pages/NavigatorCode", - "pages/NavigatorDetailCode", - "pages/PieceCode", - "pages/sourceType", - "pages/pageTransition", - "pages/pageTransition2", - "pages/scrollBar", - "pages/search", - "pages/pageTransition2", - "pages/lifecycle", - "pages/pageTransition2", - "pages/navigation", - "pages/stateStyle", - "pages/focus", - "pages/placement", - "pages/imageAnimator", - "pages/animationStatus", - "pages/sourceType", - "pages/curves", - "pages/gradientDirection", - "pages/enumsFlexAlign", - "pages/ohosRouterA", - "pages/ohosRouterB", - "pages/flexDirection", - "pages/flexWrap", - "pages/geometryTransition", - "pages/keyEvent", - "pages/enumsHorizontalAlign", - "pages/enumsVerticalAlign", - "pages/datePicker", - "pages/dragEvent", - "pages/direction2", - "pages/barState", - "pages/patternLock", - "pages/enumsImage", - "pages/slider", - "pages/edgeEffect", - "pages/appStorage", - "pages/checkbox", - "pages/checkboxGroup", - "pages/customDialogController", - "pages/select", - "pages/ohosMatrix4", - "pages/ohosPrompt", - "pages/select", - "pages/video", - "pages/refresh", - "pages/richText", - "pages/row", - "pages/textTimer", - "pages/textPickerDialog", - "pages/path", - "pages/edgeEffect", - "pages/enumsLineCapStyle", - "pages/pinchGestureInterface", - "pages/rotationGestureInterface", - "pages/gestureGroupInterface", - "pages/enumsItemAlign", - "pages/fillMode", - "pages/playMode", - "pages/swipeDirection", - "pages/gestureMode", - "pages/panDirection" + "pages/textStyle", + "pages/touchAble", + "pages/touch", + "pages/visibility", + "pages/zIndex" ], "name": ".MainAbility", "window": { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/app.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/app.ets index fc86a0485f5fa3d43dc0d7a7d858e3f41ed87304..31244da536cdae3b268f6df0a8b08a1b527be445 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/app.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/app.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/actionSheet.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/actionSheet.ets deleted file mode 100755 index 44599c3dcd8284ebdfa012ff7f73b240fff2f9e6..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/actionSheet.ets +++ /dev/null @@ -1,60 +0,0 @@ -// @ts-nocheck -/** - * 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 ActionSheetTest { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Button('Click to Show ActionSheet') - .fontSize(20) - .key("actionSheet") - .onClick(() => { - ActionSheet.show({ - title: 'ActionSheet title', - message: 'message', - confirm: { - value: 'Confirm button', - action: () => { - console.log('Get Alert Dialog handled') - } - }, - sheets: [ - { - title: 'apples', - action: () => { - console.log('apples') - } - }, - { - title: 'bananas', - action: () => { - console.log('bananas') - } - }, - { - title: 'pears', - action: () => { - console.log('pears') - } - } - ] - }) - }) - }.width('100%') - .height('100%') - } -} - diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets deleted file mode 100755 index 03bde94d20b8ffd72884966c7ab5c208468c73e5..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets +++ /dev/null @@ -1,71 +0,0 @@ -// @ts-nocheck -/** - * 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 AlertDialogExample { - build() { - Column({ space: 5 }) { - Button('one button dialog') - .onClick(() => { - AlertDialog.show( - { - title: 'title', - message: 'text', - alignment: DialogAlignment.Center, - offset: { - dx: 100, - dy: 100 - }, - confirm: { - value: 'button', - action: () => { - console.info('Button-clicking callback') - } - }, - cancel: () => { - console.info('Closed callbacks') - } - } - ) - }) - .backgroundColor(0x317aff) - Button('two button dialog') - .onClick(() => { - AlertDialog.show( - { - title: 'title', - message: 'text', - primaryButton: { - value: 'cancel', - action: () => { - console.info('Callback when the first button is clicked') - } - }, - secondaryButton: { - value: 'ok', - action: () => { - console.info('Callback when the second button is clicked') - } - }, - cancel: () => { - console.info('Closed callbacks') - } - } - ) - }).backgroundColor(0x317aff) - }.width('100%').margin({ top: 5 }) - } -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets deleted file mode 100755 index 0f1b4eb0538c28f9cb3faac7bccb362a0580fdbf..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets +++ /dev/null @@ -1,77 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; -@Entry -@Component -struct AlphabetIndexerSample { - private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', - 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; - @State color: Color = Color.Red; - @State fontSize: string = 20; - @State fontWeight: FontWeight = FontWeight.Bolder; - @State fontFamily: string = 'sans-serif'; - @State fontStyle: FontStyle = FontStyle.Italic; - @State offSetX: number = 10 - @State offSetY: number = 10 - - build() { - AlphabetIndexer({ arrayValue: this.value, selected: 0 }) - .selectedColor(0xffffff) - .selectedIndex(0) - .popupColor(0xFFFAF0) - .selectedBackgroundColor(0xCCCCCC) - .popupBackground(0xD2B48C) - .usingPopup(true) - .selectedFont({ size: 16, weight: FontWeight.Bolder }) - .popupFont({ size: 30, weight: FontWeight.Bolder }) - .itemSize(28) - .alignStyle(IndexerAlign.Left) - .popupPosition({offsetX: this.offSetX,offsetY: this.offSetY}) - .onPopupSelected((index: number) =>{ - console.info('index on action') - }) - .onSelected((index: number) => { - console.info(this.value[index] + 'is choosen'); - }) - .onRequestPopupData((index: number) =>{ - return this.value - }) - .margin({ left: 50 }) - .font({size: this.fontSize, weight: this.fontWeight, family: this.fontFamily, style: this.fontStyle }) - .color(this.color) - .key('alphabetIndexer') - } - onPageShow() { - console.info('alphabetIndexer page show called'); - var stateChangeEvent = { - eventId: 71, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("alphabetIndexer page state change called:" + JSON.stringify(eventData)); - let font = JSON.parse(eventData.data.font); - if(font) { - this.fontSize = font.size; - this.fontWeight = font.weight; - this.fontFamily = font.family; - this.fontStyle = font.style; - } - } - } -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appStorage.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appStorage.ets deleted file mode 100755 index cb5bef924d63123981d0a3da9bdaf1a7e4964e04..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appStorage.ets +++ /dev/null @@ -1,62 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct AppStorageExp { - @State countDownStartValue: number = 10 // 10 Nuggets default start value in a Game - build() { - Column() { - Text(`Grant ${this.countDownStartValue} nuggets to play.`) - Button() { - Text('+1 - Nuggets in New Game') - }.onClick(() => { - this.countDownStartValue += 1 - }) - - Button() { - Text('-1 - Nuggets in New Game') - }.onClick(() => { - this.countDownStartValue -= 1 - }) - // 创建子组件时,必须在构造函数参数中提供其@Prop变量的初始值,同时初始化常规变量CostOfOneAttump(非Prop) - CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 }) - } - } -} - -@Component -struct CountDownComponent { - @Prop count: number - private costOfOneAttempt: number - - build() { - Column() { - if (this.count > 0) { - Text(`You have ${this.count} Nuggets left`) - } else { - Text('Game over!') - } - - Button() { - Text('Try again') - }.onClick(() => { - this.count -= this.costOfOneAttempt - }) - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets index e646a392cd5dce7c899acaf17291d3ab1d4a0a02..a9635f631ea27b6c3c1c3bca0e87de54f8d9f4e7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets @@ -1,102 +1,103 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' -import prompt from '@system.prompt' - -@Entry -@Preview -@Component -struct AppearExample { - @State isShow: boolean = true - @State appearFlag: boolean = false - @State disAppearFlag: boolean = false - private changeAppear: string = 'Hide Text' - private myText: string = 'Text for onAppear' - - onPageShow() { - console.info('[appear] page show called'); - var stateChangeEvent = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - private stateChangCallBack = (eventData) => { - console.info("[appear] page stateChangCallBack"); - if (eventData != null) { - console.info("[appear] page state change called:" + JSON.stringify(eventData)); - if(eventData.data.isShow != null) { - this.isShow = eventData.data.isShow; - } - } - } - - build() { - Column() { - Button(this.changeAppear) - .key('appear') - .onClick(() => { - this.isShow = !this.isShow - }).margin(3).backgroundColor(0x2788D9) - if (this.isShow) { - Text(this.myText) - .onAppear(() => { - this.appearFlag = true - this.changeAppear = 'Show Text' - console.info('appearFlag current action state is: ' + this.appearFlag); - prompt.showToast({ message: 'The text is shown', duration: 2000 }) - try{ - var backData = { - data: { - "ACTION": this.appearFlag, - } - } - var backEvent = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - console.info("appearFlag start to emit action state") - events_emitter.emit(backEvent, backData) - }catch{ - console.info("appearFlag emit action state err: " + JSON.stringify(err.message)) - } - }) - .onDisAppear(() => { - this.disAppearFlag = true - this.changeAppear = 'Hide Text' - console.info('disAppearFlag current action state is: ' + this.disAppearFlag); - prompt.showToast({ message: 'The text is hidden', duration: 2000 }) - try{ - var backData = { - data: { - "ACTION": this.disAppearFlag, - } - } - var backEvent = { - eventId: 16, - priority: events_emitter.EventPriority.LOW - } - console.info("disAppearFlag start to emit action state") - events_emitter.emit(backEvent, backData) - }catch{ - console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message)) - } - }) - } - }.padding(30).width('100%') - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' +import prompt from '@system.prompt' + +@Entry +@Preview +@Component +struct AppearExample { + @State isShow: boolean = true + @State appearFlag: boolean = false + @State disAppearFlag: boolean = false + private changeAppear: string = 'Hide Text' + private myText: string = 'Text for onAppear' + + onPageShow() { + console.info('[appear] page show called'); + var stateChangeEvent = { + eventId: 58, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[appear] page stateChangCallBack"); + if (eventData != null) { + console.info("[appear] page state change called:" + JSON.stringify(eventData)); + if(eventData.data.isShow != null) { + this.isShow = eventData.data.isShow; + } + } + } + + build() { + Column() { + Button(this.changeAppear) + .key('appear') + .onClick(() => { + this.isShow = !this.isShow + }).margin(3).backgroundColor(0x2788D9) + if (this.isShow) { + Text(this.myText) + .onAppear(() => { + this.appearFlag = true + this.changeAppear = 'Show Text' + console.info('appearFlag current action state is: ' + this.appearFlag); + prompt.showToast({ message: 'The text is shown', duration: 2000 }) + try{ + var backData = { + data: { + "ACTION": this.appearFlag, + } + } + var backEvent = { + eventId: 59, + priority: events_emitter.EventPriority.LOW + } + console.info("appearFlag start to emit action state") + events_emitter.emit(backEvent, backData) + }catch{ + console.info("appearFlag emit action state err: " + JSON.stringify(err.message)) + } + }) + .onDisAppear(() => { + this.disAppearFlag = true + this.changeAppear = 'Hide Text' + console.info('disAppearFlag current action state is: ' + this.disAppearFlag); + prompt.showToast({ message: 'The text is hidden', duration: 2000 }) + try{ + var backData = { + data: { + "ACTION": this.disAppearFlag, + } + } + var backEvent = { + eventId: 60, + priority: events_emitter.EventPriority.LOW + } + console.info("disAppearFlag start to emit action state") + events_emitter.emit(backEvent, backData) + }catch{ + console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message)) + } + }) + } + }.padding(30).width('100%') + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets index d55db9e246cd2114cf2f1365b1ad695c12927789..e0dcb731a6fdd540d3e6a7461956613def614dbe 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets @@ -1,76 +1,78 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; -@Entry -@Component -struct AreaExample { - @State value: string = 'Text'; - @State size: string = ''; - @State onActionCalled: boolean = false; - - build() { - Column() { - Text(this.value) - .key('text1') - .backgroundColor(Color.Green) - .margin(30) - .fontSize(20) - .onClick(() => { - this.value = this.value + 'Text' - try { - var backData = { - data: { - "value": this.value, - } - } - var backEvent = { - eventId: 21, - priority: events_emitter.EventPriority.LOW - } - console.info("onClick start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onClick emit action state err: " + JSON.stringify(err.message)) - } - }) - .onAreaChange((oldValue: Area, newValue: Area) => { - console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} newvalue is ${JSON.stringify(newValue)}`) - this.size = JSON.stringify(newValue) - this.onActionCalled = true; - console.info('onAreaChange current action state is: ' + this.onActionCalled); - try { - var backData = { - data: { - "ACTION": this.onActionCalled, - } - } - var backEvent = { - eventId: 22, - priority: events_emitter.EventPriority.LOW - } - console.info("onAreaChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onAreaChange emit action state err: " + JSON.stringify(err.message)) - } - }) - Text('new area is: \n' + this.size) - .key('text2') - .margin({ right: 30, left: 30 }) - } - .width('100%').height('100%').margin({ top: 30 }) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct AreaExample { + @State value: string = 'Text'; + @State size: string = ''; + @State onActionCalled: boolean = false; + + build() { + Column() { + Text(this.value) + .key('text1') + .backgroundColor(Color.Green) + .margin(30) + .fontSize(20) + .onClick(() => { + this.value = this.value + 'Text' + try { + var backData = { + data: { + "value": this.value, + } + } + var backEvent = { + eventId: 61, + priority: events_emitter.EventPriority.LOW + } + console.info("onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + .onAreaChange((oldValue: Area, newValue: Area) => { + console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} newvalue is ${JSON.stringify(newValue)}`) + this.size = JSON.stringify(newValue) + this.onActionCalled = true; + console.info('onAreaChange current action state is: ' + this.onActionCalled); + try { + var backData = { + data: { + "ACTION": this.onActionCalled, + } + } + var backEvent = { + eventId: 62, + priority: events_emitter.EventPriority.LOW + } + console.info("onAreaChange start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onAreaChange emit action state err: " + JSON.stringify(err.message)) + } + }) + Text('new area is: \n' + this.size) + .key('text2') + .margin({ right: 30, left: 30 }) + } + .width('100%').height('100%').margin({ top: 30 }) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/barState.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/barState.ets deleted file mode 100755 index d515b1321656eb92bcae10126ab2639a23cc1dd5..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/barState.ets +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; -@Entry -@Component -struct ScrollBarExample { - private scroller: Scroller = new Scroller() - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - - build() { - Column() { - Stack({ alignContent: Alignment.End }) { - Scroll(this.scroller) { - Flex({ direction: FlexDirection.Column }) { - ForEach(this.arr, (item) => { - Row() { - Text(item.toString()) - .width('90%') - .height(100) - .backgroundColor('#3366CC') - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 5 }) - } - }, item => item) - }.margin({ left: 52 }) - } - .scrollBar(BarState.On) - .scrollable(ScrollDirection.Vertical) - ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) { - Text() - .width(30) - .height(100) - .borderRadius(10) - .backgroundColor('#C0C0C0') - }.width(30).backgroundColor('#ededed') - } - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets deleted file mode 100755 index 60dbee71da1150994935cf11acfb6852649a72a8..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets +++ /dev/null @@ -1,41 +0,0 @@ -// @ts-nocheck -/** - * 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 ColumnExample { - build() { - Column({ space: 5 }) { - Text('space').fontSize(9).fontColor(0xCCCCCC).width('90%') - Column({ space: 5 }) { - Column().width('100%').height(50).backgroundColor(0xAFEEEE) - Column().width('100%').height(50).backgroundColor(0x00FFFF).key('column') - }.width('90%').height(107).border({ width: 1 }) - - Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%') - Column() { - Column().width('50%').height(50).backgroundColor(0xAFEEEE) - Column().width('50%').height(50).backgroundColor(0x00FFFF) - }.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 }) - - Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%') - Column() { - Column().width('50%').height(50).backgroundColor(0xAFEEEE) - Column().width('50%').height(50).backgroundColor(0x00FFFF) - }.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 }) - }.width('100%').padding({ top: 5 }) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ellipse.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ellipse.ets index af2ae7740a679d46bd6d723c6f80b014d7a9da9e..23b741784ae832d923baddad5d84a29ff0086653 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ellipse.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ellipse.ets @@ -1,51 +1,52 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct EllipseExample { - @State width: string = "200px"; - @State height: string = "200px"; - - onPageShow() { - console.info('[ellipse] page show called'); - var stateChangeEvent = { - eventId: 5, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - private stateChangCallBack = (eventData) => { - console.info("[ellipse] page stateChangCallBack"); - if (eventData != null) { - console.info("[ellipse] page state change called:" + JSON.stringify(eventData)); - if(eventData.data.width != null) { - this.width = eventData.data.width; - } - if(eventData.data.height != null) { - this.height = eventData.data.height; - } - } - } - - build() { - Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center,justifyContent: FlexAlign.Center}) { - Ellipse().width(`${this.width}`).height(`${this.height}`).key('ellipse') - }.width('100%').height('100%') - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct EllipseExample { + @State width: string = "200px"; + @State height: string = "200px"; + + onPageShow() { + console.info('[ellipse] page show called'); + var stateChangeEvent = { + eventId: 92, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[ellipse] page stateChangCallBack"); + if (eventData != null) { + console.info("[ellipse] page state change called:" + JSON.stringify(eventData)); + if(eventData.data.width != null) { + this.width = eventData.data.width; + } + if(eventData.data.height != null) { + this.height = eventData.data.height; + } + } + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center,justifyContent: FlexAlign.Center}) { + Ellipse().width(`${this.width}`).height(`${this.height}`).key('ellipse') + }.width('100%').height('100%') + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enable.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enable.ets index 6567eefda9975b9fc5c268b05135b0c34e75c9b0..47d7ab5dcfadcd582632d625406ae3ab14368edf 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enable.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enable.ets @@ -1,61 +1,61 @@ -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct EnabledExample { - @State enabled: boolean = true; - @State text: string = "enable"; - - onPageShow() { - console.info('[enabled] page show called '); - var stateChangeEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - - } - - private stateChangCallBack = (eventData) => { - console.info("[stateChangCallBack] stateChangCallBack "); - if (eventData != null) { - console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); - if (eventData.data.enabled != null) { - this.enabled = eventData.data.enabled - } - if (eventData.data.text != null) { - this.text = eventData.data.text - } - } - } - - build() { - Flex({ justifyContent: FlexAlign.SpaceAround }) { - Button('disable') - .enabled(false) - .backgroundColor(0x317aff) - .opacity(0.4) - Button(this.text) - .key('enabled') - .backgroundColor(0x317aff) - .enabled(this.enabled) - } - .width('100%') - .padding({ top: 5 }) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct EnabledExample { + @State enabled: boolean = true; + @State text: string = "enable"; + + onPageShow() { + console.info('[enabled] page show called '); + var stateChangeEvent = { + eventId: 93, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + } + + private stateChangCallBack = (eventData) => { + console.info("[stateChangCallBack] stateChangCallBack "); + if (eventData != null) { + console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); + if (eventData.data.enabled != null) { + this.enabled = eventData.data.enabled + } + if (eventData.data.text != null) { + this.text = eventData.data.text + } + } + } + + build() { + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('disable') + .enabled(false) + .backgroundColor(0x317aff) + .opacity(0.4) + Button(this.text) + .key('enabled') + .backgroundColor(0x317aff) + .enabled(this.enabled) + } + .width('100%') + .padding({ top: 5 }) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flex.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flex.ets index ef2858bdb8d2670e837e25c49406b73e5c244495..ca90c9236245aedb5bb862afcd47fe62c1294d14 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flex.ets @@ -1,123 +1,124 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct FlexExample { - @State direction: FlexDirection = FlexDirection.Row - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("Flex page state change called:" + JSON.stringify(eventData)); - if(eventData.data.flexBasis != null) { - this.flexBasis = eventData.data.flexBasis; - } - if(eventData.data.flexGrow != null) { - this.flexGrow = eventData.data.flexGrow; - } - if(eventData.data.flexShrink != null) { - this.flexShrink = eventData.data.flexShrink; - } - if(eventData.data.alignSelf != null) { - this.alignSelf = eventData.data.alignSelf; - } - } - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("Flex page state change called:" + JSON.stringify(eventData)); - switch(eventData.data.alignSelf) { - case 'Auto': - this.alignSelf = ItemAlign.Auto; - break; - case 'Start': - this.alignSelf = ItemAlign.Start; - break; - case 'Center': - this.alignSelf = ItemAlign.Center; - break; - case 'End': - this.alignSelf = ItemAlign.End; - break; - case 'Stretch': - this.alignSelf = ItemAlign.Stretch; - break; - case 'Baseline': - this.alignSelf = ItemAlign.Baseline; - break; - default: - this.alignSelf = ItemAlign.Auto; - } - } - } - - onPageShow() { - console.info('flex page show called'); - var stateChangeEvent = { - eventId: 27, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - build() { - Column({ space: 5 }) { - Text('flexBasis').fontSize(9).fontColor(0xCCCCCC).width('90%') - Flex() { - Text('flexBasis("auto")') - .flexBasis('auto').key("flexBasis").width('60%').height(100).lineHeight(70) - .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) - Text('flexBasis(100)') - .flexBasis('100').height(100).lineHeight(70) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) - - Text('flexGrow').key("flexGrow").fontSize(9).fontColor(0xCCCCCC).width('90%') - Flex() { - Text('flexGrow(2)') - .flexGrow(2).height(100).lineHeight(70) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - Text('flexGrow(1)') - .flexGrow(1).height(100).lineHeight(70) - .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) - }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) - - Text('flexShrink').fontSize(9).fontColor(0xCCCCCC).width('90%') - Flex({ direction: FlexDirection.Row }) { - Text('flexShrink(0)') - .flexShrink(0).key("flexShrink").width('50%').height(100).lineHeight(70) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - Text('no flexShrink') - .width('40%').height(100).lineHeight(70).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) - Text('flexShrink(2)') - .flexShrink(2).width('40%').height(100) .lineHeight(70) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) - - Text('alignSelf').key("alignSelf").fontSize(9).fontColor(0xCCCCCC).width('90%') - Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { - Text('no alignSelf,height:80').width('33%').height(80) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - Text('alignSelf stretch') - .alignSelf(ItemAlign.Stretch).width('33%').height(80).lineHeight(70) - .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) - Text('no alignSelf,height:100').width('34%').height(100) - .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) - }.key('flex').width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) - }.width('100%').margin({ top: 5 }) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct FlexExample { + @State direction: FlexDirection = FlexDirection.Row + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("Flex page state change called:" + JSON.stringify(eventData)); + if(eventData.data.flexBasis != null) { + this.flexBasis = eventData.data.flexBasis; + } + if(eventData.data.flexGrow != null) { + this.flexGrow = eventData.data.flexGrow; + } + if(eventData.data.flexShrink != null) { + this.flexShrink = eventData.data.flexShrink; + } + if(eventData.data.alignSelf != null) { + this.alignSelf = eventData.data.alignSelf; + } + } + } + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("Flex page state change called:" + JSON.stringify(eventData)); + switch(eventData.data.alignSelf) { + case 'Auto': + this.alignSelf = ItemAlign.Auto; + break; + case 'Start': + this.alignSelf = ItemAlign.Start; + break; + case 'Center': + this.alignSelf = ItemAlign.Center; + break; + case 'End': + this.alignSelf = ItemAlign.End; + break; + case 'Stretch': + this.alignSelf = ItemAlign.Stretch; + break; + case 'Baseline': + this.alignSelf = ItemAlign.Baseline; + break; + default: + this.alignSelf = ItemAlign.Auto; + } + } + } + + onPageShow() { + console.info('flex page show called'); + var stateChangeEvent = { + eventId: 8, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Column({ space: 5 }) { + Text('flexBasis').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex() { + Text('flexBasis("auto")') + .flexBasis('auto').key("flexBasis").width('60%').height(100).lineHeight(70) + .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) + Text('flexBasis(100)') + .flexBasis('100').height(100).lineHeight(70) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) + + Text('flexGrow').key("flexGrow").fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex() { + Text('flexGrow(2)') + .flexGrow(2).height(100).lineHeight(70) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + Text('flexGrow(1)') + .flexGrow(1).height(100).lineHeight(70) + .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) + }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) + + Text('flexShrink').fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row }) { + Text('flexShrink(0)') + .flexShrink(0).key("flexShrink").width('50%').height(100).lineHeight(70) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + Text('no flexShrink') + .width('40%').height(100).lineHeight(70).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) + Text('flexShrink(2)') + .flexShrink(2).width('40%').height(100) .lineHeight(70) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) + + Text('alignSelf').key("alignSelf").fontSize(9).fontColor(0xCCCCCC).width('90%') + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { + Text('no alignSelf,height:80').width('33%').height(80) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + Text('alignSelf stretch') + .alignSelf(ItemAlign.Stretch).width('33%').height(80).lineHeight(70) + .backgroundColor(0xD2B48C).textAlign(TextAlign.Center) + Text('no alignSelf,height:100').width('34%').height(100) + .backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) + }.key('flex').width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) + }.width('100%').margin({ top: 5 }) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gauge.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gauge.ets index 49fd9f4f25531e7c6be09d175da3fe0f8a0ebec0..4c31e891f4cc2ea23f4f6085d0edb2aa19b8eb80 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gauge.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gauge.ets @@ -1,76 +1,77 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct GaugeExample { - @State gaugeValue: string = 50; - @State strokeWidthValue: string = 20; - @State startAngleValue: string = 210; - @State endAngleValue: string = 150; - @State colorValues: Array = [[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]]; - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("gauge page state change called:" + JSON.stringify(eventData)); - if(eventData.data.gaugeValue != null) { - this.gaugeValue = eventData.data.gaugeValue; - } - if(eventData.data.strokeWidthValue != null) { - this.strokeWidthValue = eventData.data.strokeWidthValue; - } - if(eventData.data.startAngleValue != null) { - this.startAngleValue = eventData.data.startAngleValue; - } - if(eventData.data.endAngleValue != null) { - this.endAngleValue = eventData.data.endAngleValue; - } - if(eventData.data.colorValues != null) { - this.colorValues = JSON.parse(eventData.data.colorValues); - } - } - } - - onPageShow() { - console.info('gauge page show called'); - var stateChangeEvent = { - eventId: 1, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - - var stateChangeEventTwo = { - eventId: 2, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventTwo, this.stateChangCallBack); - } - - build() { - Column() { - Gauge({ value: 0, min: 0, max: 100 }) - .key("gauge") - .value(`${this.gaugeValue}`) - .startAngle(`${this.startAngleValue}`) - .endAngle(`${this.endAngleValue}`) - .colors(this.colorValues) - .strokeWidth(`${this.strokeWidthValue}`) - .width(200).height(200) - }.width('100%').margin({ top: 300 }) - } -} - +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct GaugeExample { + @State gaugeValue: string = 50; + @State strokeWidthValue: string = 20; + @State startAngleValue: string = 210; + @State endAngleValue: string = 150; + @State colorValues: Array = [[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]]; + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("gauge page state change called:" + JSON.stringify(eventData)); + if(eventData.data.gaugeValue != null) { + this.gaugeValue = eventData.data.gaugeValue; + } + if(eventData.data.strokeWidthValue != null) { + this.strokeWidthValue = eventData.data.strokeWidthValue; + } + if(eventData.data.startAngleValue != null) { + this.startAngleValue = eventData.data.startAngleValue; + } + if(eventData.data.endAngleValue != null) { + this.endAngleValue = eventData.data.endAngleValue; + } + if(eventData.data.colorValues != null) { + this.colorValues = JSON.parse(eventData.data.colorValues); + } + } + } + + onPageShow() { + console.info('gauge page show called'); + var stateChangeEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEventTwo = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBack); + } + + build() { + Column() { + Gauge({ value: 0, min: 0, max: 100 }) + .key("gauge") + .value(`${this.gaugeValue}`) + .startAngle(`${this.startAngleValue}`) + .endAngle(`${this.endAngleValue}`) + .colors(this.colorValues) + .strokeWidth(`${this.strokeWidthValue}`) + .width(200).height(200) + }.width('100%').margin({ top: 300 }) + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/clickEvent.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/clickEvent.ets deleted file mode 100755 index 55938a183a0531d2b3dfa6be11ea1fed9864ed3f..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/clickEvent.ets +++ /dev/null @@ -1,53 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct ClickExample { - @State text: string = ''; - @State onClickValue: boolean = false; - - build() { - Column() { - Button('Click').backgroundColor(0x2788D9).width(200).height(100).fontSize(20) - .onClick((event: ClickEvent) => { - console.info(this.text = 'Click Point:' + '\n screenX:' + event.screenX + '\n screenY:' + event.screenY - + '\n x :' + event.x + '\n y:' + event.y + '\ntarget:' + '\n component globalPos:(' - + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\n width:' - + event.target.area.width + '\n height:' + event.target.area.height); - this.onClickValue = true; - try { - var backData = { - data: { - "ACTION": this.onClickValue, - "event": JSON.stringify(event) - } - } - var backEvent = { - eventId: 30, - priority: events_emitter.EventPriority.LOW - } - console.info("click to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("click action state err: " + JSON.stringify(err.message)) - } - }).key('button') - Text(this.text).padding(15).fontSize(20).key('text') - }.height(350).width('100%').padding(10) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/sizeSetting.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/sizeSetting.ets deleted file mode 100755 index 6497468ba749ce6bb5a471d3624eb46937bb0621..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/sizeSetting.ets +++ /dev/null @@ -1,131 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct SizeSetting { - @State width: string = 80; - @State height: string = 80; - @State padding: string = 20; - @State margin: string = 20; - @State sizeWidth: string = '100%'; - @State sizeHeight: string = '100%'; - @State layoutWeight1: string = 1; - @State layoutWeight2: string = 2; - - build() { - Column({ space: 10 }) { - Text('margin and padding:').fontSize(26).fontColor(Color.Black).width('90%') - Row() { - Row() { - Row() - .size({ width: this.sizeWidth, height: this.sizeHeight }) - .backgroundColor(0xAFEEEE) - .key('innerRow') - } - .key('centerRow') - .width(this.width) - .height(this.height) - .padding(this.padding) - .margin(this.margin) - .backgroundColor(0xFDF5E6) - }.backgroundColor(0xFFA500) - - Text('layoutWeight') - .fontSize(26) - .fontColor(Color.Black) - .width('90%') - Row() { - Text('layoutWeight(1)') - .size({ width: '30%', height: 110 }) - .backgroundColor(0xFFEFD5) - .textAlign(TextAlign.Center) - .layoutWeight(this.layoutWeight1) - .fontSize(20) - .key('layoutWeight1') - Text('layoutWeight(2)') - .size({ width: '30%', height: 110 }) - .backgroundColor(0xF5DEB3) - .textAlign(TextAlign.Center) - .layoutWeight(this.layoutWeight2) - .fontSize(20) - .key('layoutWeight2') - Text('no layoutWeight') - .size({ width: '30%', height: 110 }) - .backgroundColor(0xD2B48C) - .textAlign(TextAlign.Center) - .fontSize(20) - }.size({ width: '90%', height: 140 }) - .backgroundColor(0xAFEEEE) - - Text('constraintSize') - .fontSize(26) - .fontColor(Color.Black) - .width('90%') - Row() { - Row() - .constraintSize({minWidth: '10%', maxWidth: '50%', height: 70}) - .backgroundColor(0xFFA500) - Row() - .size({width: '30%', height:70}) - .backgroundColor(0xAFEEEE) - }.size({ width: '90%', height: 140 }) - .backgroundColor(0xAFEEEE) - }.width('100%').margin({ top: 5 }) - } - onPageShow() { - let stateChangeEvent = { - eventId: 28, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - - let sizeChangeEvent = { - eventId: 29, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(sizeChangeEvent, this.sizeChangCallBack) - - let weightChangeEvent = { - eventId: 32, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(weightChangeEvent, this.weightChangCallBack) - } - stateChangCallBack = (eventData) => { - console.info("size page stateChangCallBack" + JSON.stringify(eventData)); - if (eventData) { - this.width = eventData.data.width; - this.height = eventData.data.height; - this.padding = eventData.data.padding; - this.margin = eventData.data.margin; - } - } - sizeChangCallBack = (eventData) => { - console.info("size page sizeChangCallBack" + JSON.stringify(eventData)); - if (eventData) { - this.sizeWidth = eventData.data.width; - this.sizeHeight = eventData.data.height; - } - } - weightChangCallBack = (eventData) => { - console.info("size page weightChangCallBack" + JSON.stringify(eventData)); - if (eventData) { - this.layoutWeight1 = eventData.data.weight; - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureGroupInterface.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureGroupInterface.ets deleted file mode 100755 index a8b59b61d1858c437bfcb772b69c839cc00ff791..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureGroupInterface.ets +++ /dev/null @@ -1,57 +0,0 @@ -// @ts-nocheck -/** - * 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 GestureGroupExample { - @State count: number = 0 - @State offsetX: number = 0 - @State offsetY: number = 0 - @State borderStyle: BorderStyle = BorderStyle.Solid - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) - }.translate({ x: this.offsetX, y: this.offsetY, z: 5 }) - .key('gestureGroup') - .height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyle }) - .gesture( - GestureGroup(GestureMode.Sequence, - LongPressGesture({ repeat: true }) - .onAction((event: GestureEvent) => { - if (event.repeat) {this.count++} - console.log('LongPress onAction') - }) - .onActionEnd(() => { - console.log('LongPress end') - }), - PanGesture({}) - .onActionStart(() => { - this.borderStyle = BorderStyle.Dashed - console.log('pan start') - }) - .onActionUpdate((event: GestureEvent) => { - this.offsetX = event.offsetX - this.offsetY = event.offsetY - console.log('pan update') - }) - ) - .onCancel(() => { - console.log('sequence gesture canceled') - }) - ) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets new file mode 100755 index 0000000000000000000000000000000000000000..4c090f354c5129d8c8f02390e8dea9b5a6cce802 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets @@ -0,0 +1,79 @@ +// @ts-nocheck +/** + * 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 GlobalExample { + + onPageShow() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Canvas(this.context) + .width('100%').height('40%').backgroundColor('#00ffff') + .onReady(() => { + this.context.imageSmoothingEnabled = false + this.testImageBitmapSize(); + this.testOffscreenCanvas(); + this.testImageData(); + this.testImage(); + }) + }.width('100%').height('100%') + } + + testImageBitmapSize() { + let img = new ImageBitmap("/images/bg.jpg"); + let width = img.width; + let height = img.height; + this.context.imageSmoothingEnabled = false; + this.context.drawImage( img, 30, 950, 160, 100); + console.log("imagebitmap_width="+width); + console.log("imagebitmap_height="+height); + } + + testOffscreenCanvas() { + var offscreen = new OffscreenCanvas(300, 300); + var offCanvas2 = offscreen.getContext("2d"); + var img = new Image(); + img.src = "/images/bg.jpg"; + offCanvas2.drawImage(img, 0, 0, 100, 100); + + var bitmap = offscreen.transferToImageBitmap(); + this.ctx.transferFromImageBitmap(bitmap); + } + + testImageData() { + var offscreen = new OffscreenCanvas(300, 300); + var offCanvas2 = offscreen.getContext("2d"); + var imageData = offCanvas2.createImageData(100,100); + var imgData = imageData.data; + console.log("imageData_width="+imageData.width); + console.log("imageData_height="+imageData.height); + } + + testImage(){ + var img = new Image("/images/bg.jpg",100,100) + .onload(()=>{}) + .onerror(()=>{}); + console.log("img_width="+img.width); + console.log("img_height="+img.height); + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets index 4077f6540e88b4c1714400a8983a43168fc4ada0..99ba9e26ad1a8c21b56c6c4d12f54ae81fba4acb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets @@ -1,109 +1,110 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct GridContainerExample { - @State sizeType: SizeType = SizeType.XS; - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("gridContainer page state change called:" + JSON.stringify(eventData)); - switch (eventData.data.sizeType) { - case 'Auto': - this.sizeType = SizeType.Auto; - break; - case 'XS': - this.sizeType = SizeType.XS; - break; - case 'SM': - this.sizeType = SizeType.SM; - break; - case 'MD': - this.sizeType = SizeType.MD; - break; - case 'LG': - this.sizeType = SizeType.LG; - break; - default: - this.sizeType = SizeType.Auto; - } - } - } - - onPageShow() { - console.info('gridContainer page show called'); - var stateChangeEvent = { - eventId: 7, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - build() { - Column({ space: 5 }) { - GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) { - Row() { - Text('1') - .fontSize(20) - .useSizeType({ - xs: { span: 6, offset: 0 }, - sm: { span: 2, offset: 0 }, - md: { span: 2, offset: 0 }, - lg: { span: 2, offset: 0 } - }) - .height(50) - .backgroundColor(0x4582B4) - .textAlign(TextAlign.Center) - Text('2') - .fontSize(20) - .useSizeType({ - xs: { span: 2, offset: 6 }, - sm: { span: 6, offset: 2 }, - md: { span: 2, offset: 2 }, - lg: { span: 2, offset: 2 } - }) - .height(50) - .backgroundColor(0x00BFFF) - .textAlign(TextAlign.Center) - Text('3') - .fontSize(20) - .useSizeType({ - xs: { span: 2, offset: 8 }, - sm: { span: 2, offset: 8 }, - md: { span: 6, offset: 4 }, - lg: { span: 2, offset: 4 } - }) - .height(50) - .backgroundColor(0x4682B4) - .textAlign(TextAlign.Center) - Text('4') - .fontSize(20) - .useSizeType({ - xs: { span: 2, offset: 10 }, - sm: { span: 2, offset: 10 }, - md: { span: 2, offset: 10 }, - lg: { span: 6, offset: 6 } - }) - - .height(50) - .backgroundColor(0x00BFFF) - .textAlign(TextAlign.Center) - } - }.width('90%').key('gridContainer').margin({ top: 300 }) - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct GridContainerExample { + @State sizeType: SizeType = SizeType.XS; + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("gridContainer page state change called:" + JSON.stringify(eventData)); + switch (eventData.data.sizeType) { + case 'Auto': + this.sizeType = SizeType.Auto; + break; + case 'XS': + this.sizeType = SizeType.XS; + break; + case 'SM': + this.sizeType = SizeType.SM; + break; + case 'MD': + this.sizeType = SizeType.MD; + break; + case 'LG': + this.sizeType = SizeType.LG; + break; + default: + this.sizeType = SizeType.Auto; + } + } + } + + onPageShow() { + console.info('gridContainer page show called'); + var stateChangeEvent = { + eventId: 109, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Column({ space: 5 }) { + GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) { + Row() { + Text('1') + .fontSize(20) + .useSizeType({ + xs: { span: 6, offset: 0 }, + sm: { span: 2, offset: 0 }, + md: { span: 2, offset: 0 }, + lg: { span: 2, offset: 0 } + }) + .height(50) + .backgroundColor(0x4582B4) + .textAlign(TextAlign.Center) + Text('2') + .fontSize(20) + .useSizeType({ + xs: { span: 2, offset: 6 }, + sm: { span: 6, offset: 2 }, + md: { span: 2, offset: 2 }, + lg: { span: 2, offset: 2 } + }) + .height(50) + .backgroundColor(0x00BFFF) + .textAlign(TextAlign.Center) + Text('3') + .fontSize(20) + .useSizeType({ + xs: { span: 2, offset: 8 }, + sm: { span: 2, offset: 8 }, + md: { span: 6, offset: 4 }, + lg: { span: 2, offset: 4 } + }) + .height(50) + .backgroundColor(0x4682B4) + .textAlign(TextAlign.Center) + Text('4') + .fontSize(20) + .useSizeType({ + xs: { span: 2, offset: 10 }, + sm: { span: 2, offset: 10 }, + md: { span: 2, offset: 10 }, + lg: { span: 6, offset: 6 } + }) + + .height(50) + .backgroundColor(0x00BFFF) + .textAlign(TextAlign.Center) + } + }.width('90%').key('gridContainer').margin({ top: 300 }) + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/gridSettings.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridSettings.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/gridSettings.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridSettings.ets index 650a889413607c7d981da21ac20f7901dafc629a..b9999409c5df6eb0725f01837f897a6d20b3a73e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/gridSettings.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridSettings.ets @@ -1,90 +1,91 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct GridSetting { - @State smSpan: number = 2; - @State smOffset: number = 1; - @State gridSpan: number = 1; - @State gridOffset: number = 0; - - build(){ - GridContainer({sizeType: SizeType.SM}) { - Row({}) { - Row() { - Text('Left').fontSize(25) - } - .gridOffset(this.gridOffset) - .height("100%") - .backgroundColor(0x66bbb2cb) - .key('gridOffset') - Row() { - Text('Center').fontSize(25) - } - .useSizeType({ - xs: { span: 1, offset: 0 }, sm: { span: this.smSpan, offset: this.smOffset }, - md: { span: 5, offset: 1 }, lg: { span: 7, offset: 2 } - }) - .height("100%") - .backgroundColor(0x66b6c5d1) - .key('gridRow') - Row() { - Text('Right').fontSize(25) - } - .gridSpan(this.gridSpan) - .height("100%") - .backgroundColor(0x66bbb2cb) - .key('gridSpan') - } - .height(200) - } - .backgroundColor(0xf1f3f5) - .margin({ top: 10 }) - .key('gridContainer') - } - onPageShow() { - let smChangeEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(smChangeEvent, this.stateChangCallBack); - let offsetChangeEvent = { - eventId: 46, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(offsetChangeEvent, this.stateChangCallBack); - let spanChangeEvent = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(spanChangeEvent, this.stateChangCallBack); - } - stateChangCallBack = (eventData) => { - console.info("GridSetting page stateChangCallBack" + JSON.stringify(eventData)); - if (eventData && eventData.data) { - if (eventData.data.span) { - this.smSpan = eventData.data.span; - this.smOffset = eventData.data.offset; - } else if (eventData.data.gridOffset) { - this.gridOffset = eventData.data.gridOffset; - } else if (eventData.data.gridSpan) { - this.gridSpan = eventData.data.gridSpan; - } - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct GridSetting { + @State smSpan: number = 2; + @State smOffset: number = 1; + @State gridSpan: number = 1; + @State gridOffset: number = 0; + + build(){ + GridContainer({sizeType: SizeType.SM}) { + Row({}) { + Row() { + Text('Left').fontSize(25) + } + .gridOffset(this.gridOffset) + .height("100%") + .backgroundColor(0x66bbb2cb) + .key('gridOffset') + Row() { + Text('Center').fontSize(25) + } + .useSizeType({ + xs: { span: 1, offset: 0 }, sm: { span: this.smSpan, offset: this.smOffset }, + md: { span: 5, offset: 1 }, lg: { span: 7, offset: 2 } + }) + .height("100%") + .backgroundColor(0x66b6c5d1) + .key('gridRow') + Row() { + Text('Right').fontSize(25) + } + .gridSpan(this.gridSpan) + .height("100%") + .backgroundColor(0x66bbb2cb) + .key('gridSpan') + } + .height(200) + } + .backgroundColor(0xf1f3f5) + .margin({ top: 10 }) + .key('gridContainer') + } + onPageShow() { + let smChangeEvent = { + eventId: 9, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(smChangeEvent, this.stateChangCallBack); + let offsetChangeEvent = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(offsetChangeEvent, this.stateChangCallBack); + let spanChangeEvent = { + eventId: 11, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(spanChangeEvent, this.stateChangCallBack); + } + stateChangCallBack = (eventData) => { + console.info("GridSetting page stateChangCallBack" + JSON.stringify(eventData)); + if (eventData && eventData.data) { + if (eventData.data.span) { + this.smSpan = eventData.data.span; + this.smOffset = eventData.data.offset; + } else if (eventData.data.gridOffset) { + this.gridOffset = eventData.data.gridOffset; + } else if (eventData.data.gridSpan) { + this.gridSpan = eventData.data.gridSpan; + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/hover.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/hover.ets deleted file mode 100755 index 81956c3dc559b9495dc6d6baeb97d928e53fc6ec..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/hover.ets +++ /dev/null @@ -1,57 +0,0 @@ -// @ts-nocheck -/** - * 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 HoverExample { - @State isHoverVal: boolean = false - @State hoverEffect1: HoverEffect = HoverEffect.Auto - @State hoverEffect2: HoverEffect = HoverEffect.Board - @State hoverEffect3: HoverEffect = HoverEffect.None - - build() { - Column({ space: 5 }) { - Column({ space: 5 }) { - Text('Scale').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 80 }) - Column() - .width('80%').height(200).backgroundColor(Color.Gray) - .position({ x: 40, y: 120 }) - .hoverEffect(this.hoverEffect1) - .key('bindContextMenu') - .onHover((isHover: boolean) => { - console.info('Scale' + isHover) - this.isHoverVal = isHover - }) - - Text('Board').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 380 }) - Column() - .width('80%').height(200).backgroundColor(Color.Gray) - .hoverEffect(this.hoverEffect2) - .position({ x: 40, y: 420 }) - .onHover((isHover: boolean) => { - console.info('HoverEffect.Board') - this.isHoverVal = isHover - }) - } - .hoverEffect(this.hoverEffect3) - .width('100%').height('100%').border({ width: 1 }) - .onHover((isHover: boolean) => { - console.info('HoverEffect.None') - this.isHoverVal = isHover - }) - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/imageEffects.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageEffects.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/imageEffects.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageEffects.ets index 0bbacea16d3b4f8c617b28f66216b6e39e329ba8..e9da3e7d11670c50c80a8419a4bd15f9776e3edb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/imageEffects.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageEffects.ets @@ -1,164 +1,165 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct ImageEffectsExample { - @State blurValue: string = 100; - @State backdropBlueValue: string= 30; - @State shadowValue: object= { radius: 10, color: Color.Gray, offsetX: 5, offsetY: 5 } - @State grayscaleValue: string= 10; - @State brightnessValue: string= 20; - @State saturateValue: string= 50; - @State contrastValue: string= 20; - @State invertValue: string= 10; - @State hueRotateValue: string= 10 - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("imageEffects page state change called:" + JSON.stringify(eventData)); - if (eventData.data.blurValue != null) { - this.blurValue = eventData.data.blurValue; - } - if (eventData.data.shadowValue != null) { - this.shadowValue = JSON.parse(eventData.data.shadowValue); - } - if (eventData.data.grayscaleValue != null) { - this.grayscaleValue = eventData.data.grayscaleValue; - } - if (eventData.data.brightnessValue != null) { - this.brightnessValue = eventData.data.brightnessValue; - } - if (eventData.data.saturateValue != null) { - this.saturateValue = eventData.data.saturateValue; - } - if (eventData.data.contrastValue != null) { - this.contrastValue = eventData.data.contrastValue; - } - if (eventData.data.invertValue != null) { - this.invertValue = eventData.data.invertValue; - } - if (eventData.data.hueRotateValue != null) { - this.hueRotateValue = eventData.data.hueRotateValue; - } - } - } - - onPageShow() { - console.info('imageEffects page show called'); - var stateChangeEvent = { - eventId: 40, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - - var stateChangeEvent2 = { - eventId: 41, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent2, this.stateChangCallBack); - - var stateChangeEvent3 = { - eventId: 42, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent3, this.stateChangCallBack); - - var stateChangeEvent4 = { - eventId: 43, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent4, this.stateChangCallBack); - - var stateChangeEvent5 = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent5, this.stateChangCallBack); - - var stateChangeEvent6 = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent6, this.stateChangCallBack); - - var stateChangeEvent7 = { - eventId: 46, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent7, this.stateChangCallBack); - - var stateChangeEvent8 = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent8, this.stateChangCallBack); - } - - build() { - Column({ space: 10 }) { - Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%') - Text('text') - .blur(this.blurValue) - .width('90%') - .height(40) - .fontSize(16) - .backgroundColor(0xF9CF93) - .padding({ left: 5 }) - .key('centerRow') - - Text('backdropBlur').fontSize(15).fontColor(0xCCCCCC).width('90%') - Text() - .width('90%') - .height(40) - .fontSize(16) - .backdropBlur(this.backdropBlueValue) - .backgroundImage('/images/download.png') - .backgroundImageSize({ width: 1200, height: 160 }) - .key('centerRow2') - - Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png') - .width('90%') - .height(40) - .shadow(this.shadowValue) - .key('centerRow3') - - Text('grayscale').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png') - .width('90%') - .height(40) - .grayscale(`${this.grayscaleValue}`) - .key('centerRow4') - - Text('brightness').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png').width('90%').height(40).brightness(this.brightnessValue).key('centerRow5') - - Text('saturate').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png').width('90%').height(40).saturate(this.saturateValue).key('centerRow6') - - Text('contrast').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png').width('90%').height(40).contrast(this.contrastValue).key('centerRow7') - - Text('invert').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png').width('90%').height(40).invert(`${this.invertValue}`).key('centerRow8') - - Text('hueRotate').fontSize(15).fontColor(0xCCCCCC).width('90%') - Image('/images/download.png').width('90%').height(40).hueRotate(`${this.hueRotateValue}`).key('centerRow9') - }.width('100%').margin({ top: 5 }) - } -} +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct ImageEffectsExample { + @State blurValue: string = 100; + @State backdropBlueValue: string= 30; + @State shadowValue: object= { radius: 10, color: Color.Gray, offsetX: 5, offsetY: 5 } + @State grayscaleValue: string= 10; + @State brightnessValue: string= 20; + @State saturateValue: string= 50; + @State contrastValue: string= 20; + @State invertValue: string= 10; + @State hueRotateValue: string= 10 + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("imageEffects page state change called:" + JSON.stringify(eventData)); + if (eventData.data.blurValue != null) { + this.blurValue = eventData.data.blurValue; + } + if (eventData.data.shadowValue != null) { + this.shadowValue = JSON.parse(eventData.data.shadowValue); + } + if (eventData.data.grayscaleValue != null) { + this.grayscaleValue = eventData.data.grayscaleValue; + } + if (eventData.data.brightnessValue != null) { + this.brightnessValue = eventData.data.brightnessValue; + } + if (eventData.data.saturateValue != null) { + this.saturateValue = eventData.data.saturateValue; + } + if (eventData.data.contrastValue != null) { + this.contrastValue = eventData.data.contrastValue; + } + if (eventData.data.invertValue != null) { + this.invertValue = eventData.data.invertValue; + } + if (eventData.data.hueRotateValue != null) { + this.hueRotateValue = eventData.data.hueRotateValue; + } + } + } + + onPageShow() { + console.info('imageEffects page show called'); + var stateChangeEvent = { + eventId: 12, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEvent2 = { + eventId: 13, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent2, this.stateChangCallBack); + + var stateChangeEvent3 = { + eventId: 14, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent3, this.stateChangCallBack); + + var stateChangeEvent4 = { + eventId: 15, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent4, this.stateChangCallBack); + + var stateChangeEvent5 = { + eventId: 16, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent5, this.stateChangCallBack); + + var stateChangeEvent6 = { + eventId: 17, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent6, this.stateChangCallBack); + + var stateChangeEvent7 = { + eventId: 18, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent7, this.stateChangCallBack); + + var stateChangeEvent8 = { + eventId: 19, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent8, this.stateChangCallBack); + } + + build() { + Column({ space: 10 }) { + Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%') + Text('text') + .blur(this.blurValue) + .width('90%') + .height(40) + .fontSize(16) + .backgroundColor(0xF9CF93) + .padding({ left: 5 }) + .key('centerRow') + + Text('backdropBlur').fontSize(15).fontColor(0xCCCCCC).width('90%') + Text() + .width('90%') + .height(40) + .fontSize(16) + .backdropBlur(this.backdropBlueValue) + .backgroundImage('/images/download.png') + .backgroundImageSize({ width: 1200, height: 160 }) + .key('centerRow2') + + Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png') + .width('90%') + .height(40) + .shadow(this.shadowValue) + .key('centerRow3') + + Text('grayscale').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png') + .width('90%') + .height(40) + .grayscale(`${this.grayscaleValue}`) + .key('centerRow4') + + Text('brightness').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png').width('90%').height(40).brightness(this.brightnessValue).key('centerRow5') + + Text('saturate').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png').width('90%').height(40).saturate(this.saturateValue).key('centerRow6') + + Text('contrast').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png').width('90%').height(40).contrast(this.contrastValue).key('centerRow7') + + Text('invert').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png').width('90%').height(40).invert(`${this.invertValue}`).key('centerRow8') + + Text('hueRotate').fontSize(15).fontColor(0xCCCCCC).width('90%') + Image('/images/download.png').width('90%').height(40).hueRotate(`${this.hueRotateValue}`).key('centerRow9') + }.width('100%').margin({ top: 5 }) + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets index a9c75c7154b8b5d6f5f76b1cf05cff275d4386f4..2607563902184ddd2914549d08ddc135b004b31a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,64 +1,64 @@ -// @ts-nocheck -/** - * 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 file from '@system.file'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; -import featureAbility from "@ohos.ability.featureAbility"; - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - console.info("start run testcase!!!!") - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - console.info('parameters---->' + JSON.stringify(Want.parameters)); - configService.setConfig(Want.parameters); - testsuite(); - core.execute(); - console.info('Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error('Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('ACE ETS TEST') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - +// @ts-nocheck +/** + * 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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/keyEvent.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/keyEvent.ets deleted file mode 100755 index a5f16dafcdb6561b8e8a2859e6b4fbf9e752d1c0..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/keyEvent.ets +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct KeyEventExample { - @State text: string = '' - @State textOne: string = '' - @State textTwo: string = '' - @State textThree: string = '' - @State eventType: string = '' - - build() { - Column() { - Button('KeyEvent').backgroundColor(0x2788D9) - .onKeyEvent((event: KeyEvent) => { - if (event.type === KeyType.Down) { - this.eventType = 'Down' - } - if (event.type === KeyType.Up) { - this.eventType = 'Up' - } - if (event.type === keySource.Unknown) { - this.eventType = 'Unknown' - } - if (event.type === keySource.Keyboard) { - this.eventType = 'Keyboard' - } - console.info(this.text = 'KeyType:' + this.eventType + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText) - console.info(this.textOne = 'KeySource:' + event.keySource + '\ndeviceId:' + event.deviceId + '\nmetaKey:' + event.metaKey + '\ntimeStamp:' + event.timestamp) - console.info(this.textTwo = 'KeyType:' + this.keySource + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText) - console.info(this.textThree = 'KeyType:' + this.keySource + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText) - stopPropagation: () => { - console.info('stopPropagation') - } - }) - Text(this.text).padding(15) - }.height(300).width('100%').padding(35) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/layoutConstraints.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/layoutConstraints.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/layoutConstraints.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/layoutConstraints.ets index 2cd75c55eafaed748ce49cada8b0eda115ca6230..969a0c095421478d9886bdd09e7e705514f1d58f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/layoutConstraints.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/layoutConstraints.ets @@ -1,135 +1,136 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -class ContainerInfo { - label : string = '' - size : string = '' -}; - -class ChildInfo { - text : string = '' - priority : number = 0 -}; - -@Entry -@Component -struct LayoutConstraints { - private children : string[] = ['1', '2', '3', '4', '5', '6']; - @State aspectRatio: number = 1.5; - private container: ContainerInfo[] = [ - {label: 'Big container', size: '97%'}, - {label: 'Small container', size: '30%'}]; - @State priorityChildren: any[] = [ - {text: '1\n(priority:1)', priority: 1}, - {text: '2\n(priority:2)', priority: 2}, - {text: '3\n(priority:3)', priority: 3}, - {text: '4\n(priority:4)', priority: 4}]; - @State currentIndex : number = 0; - - build() { - Column({ space: 20 }) { - Text('using container: row').fontSize(20).fontColor(Color.Black).width('100%') - Row({space: 10}) { - ForEach(this.children, (item) => { - Text(item) - .backgroundColor(0xbbb2cb) - .fontSize(20) - .aspectRatio(this.aspectRatio) - .height(60) - Text(item) - .backgroundColor(0xbbb2cb) - .fontSize(20) - .aspectRatio(this.aspectRatio) - .width(60) - .key('aspectRatio') - }, item=>item) - } - .size({width: "100%", height: 100}) - .backgroundColor(0xd2cab3) - .clip(true) - - Text('using container: grid').fontSize(20).fontColor(Color.Black).width('100%') - Grid() { - ForEach(this.children, (item) => { - GridItem() { - Text(item) - .backgroundColor(0xbbb2cb) - .fontSize(40) - .aspectRatio(this.aspectRatio) - } - }, item=>item) - } - .columnsTemplate('1fr 1fr 1fr') - .columnsGap(10) - .rowsGap(10) - .size({width: "100%", height: 165}) - .backgroundColor(0xd2cab3) - - Text('displayPriority 4').fontSize(20).fontColor(Color.Black).width('100%') - Flex({justifyContent: FlexAlign.SpaceBetween}) { - ForEach(this.priorityChildren, (item)=>{ - if (item.priority === 1 || item.priority === 5) { - Text(`1\n(priority:${item.priority})`) - .width(135) - .height(60) - .fontSize(18) - .textAlign(TextAlign.Center) - .backgroundColor(0xbbb2cb) - .displayPriority(item.priority) - .key('displayPriority') - } else { - Text(item.text) - .width(135) - .height(60) - .fontSize(18) - .textAlign(TextAlign.Center) - .backgroundColor(0xbbb2cb) - .displayPriority(item.priority) - } - }, item=>item.text) - } - .width(this.container[this.currentIndex].size) - .backgroundColor(0xd2cab3) - }.padding(10) - } - onPageShow() { - let aspectRatioChangeEvent = { - eventId: 26, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(aspectRatioChangeEvent, this.stateChangCallBack); - - let priorityChangeEvent = { - eventId: 27, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(priorityChangeEvent, this.stateChangCallBack); - } - stateChangCallBack = (eventData) => { - console.info("LayoutConstraints page stateChangCallBack" + JSON.stringify(eventData)); - if (eventData) { - if (eventData.data.aspectRatio) { - this.aspectRatio = eventData.data.aspectRatio; - } else if (eventData.data.displayPriority) { - let priority = JSON.parse(JSON.stringify(this.priorityChildren)); - priority[0].priority = eventData.data.displayPriority; - this.priorityChildren = []; - this.priorityChildren = priority; - } - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +class ContainerInfo { + label : string = '' + size : string = '' +}; + +class ChildInfo { + text : string = '' + priority : number = 0 +}; + +@Entry +@Component +struct LayoutConstraints { + private children : string[] = ['1', '2', '3', '4', '5', '6']; + @State aspectRatio: number = 1.5; + private container: ContainerInfo[] = [ + {label: 'Big container', size: '97%'}, + {label: 'Small container', size: '30%'}]; + @State priorityChildren: any[] = [ + {text: '1\n(priority:1)', priority: 1}, + {text: '2\n(priority:2)', priority: 2}, + {text: '3\n(priority:3)', priority: 3}, + {text: '4\n(priority:4)', priority: 4}]; + @State currentIndex : number = 0; + + build() { + Column({ space: 20 }) { + Text('using container: row').fontSize(20).fontColor(Color.Black).width('100%') + Row({space: 10}) { + ForEach(this.children, (item) => { + Text(item) + .backgroundColor(0xbbb2cb) + .fontSize(20) + .aspectRatio(this.aspectRatio) + .height(60) + Text(item) + .backgroundColor(0xbbb2cb) + .fontSize(20) + .aspectRatio(this.aspectRatio) + .width(60) + .key('aspectRatio') + }, item=>item) + } + .size({width: "100%", height: 100}) + .backgroundColor(0xd2cab3) + .clip(true) + + Text('using container: grid').fontSize(20).fontColor(Color.Black).width('100%') + Grid() { + ForEach(this.children, (item) => { + GridItem() { + Text(item) + .backgroundColor(0xbbb2cb) + .fontSize(40) + .aspectRatio(this.aspectRatio) + } + }, item=>item) + } + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .size({width: "100%", height: 165}) + .backgroundColor(0xd2cab3) + + Text('displayPriority 4').fontSize(20).fontColor(Color.Black).width('100%') + Flex({justifyContent: FlexAlign.SpaceBetween}) { + ForEach(this.priorityChildren, (item)=>{ + if (item.priority === 1 || item.priority === 5) { + Text(`1\n(priority:${item.priority})`) + .width(135) + .height(60) + .fontSize(18) + .textAlign(TextAlign.Center) + .backgroundColor(0xbbb2cb) + .displayPriority(item.priority) + .key('displayPriority') + } else { + Text(item.text) + .width(135) + .height(60) + .fontSize(18) + .textAlign(TextAlign.Center) + .backgroundColor(0xbbb2cb) + .displayPriority(item.priority) + } + }, item=>item.text) + } + .width(this.container[this.currentIndex].size) + .backgroundColor(0xd2cab3) + }.padding(10) + } + onPageShow() { + let aspectRatioChangeEvent = { + eventId: 20, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(aspectRatioChangeEvent, this.stateChangCallBack); + + let priorityChangeEvent = { + eventId: 21, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(priorityChangeEvent, this.stateChangCallBack); + } + stateChangCallBack = (eventData) => { + console.info("LayoutConstraints page stateChangCallBack" + JSON.stringify(eventData)); + if (eventData) { + if (eventData.data.aspectRatio) { + this.aspectRatio = eventData.data.aspectRatio; + } else if (eventData.data.displayPriority) { + let priority = JSON.parse(JSON.stringify(this.priorityChildren)); + priority[0].priority = eventData.data.displayPriority; + this.priorityChildren = []; + this.priorityChildren = priority; + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets deleted file mode 100755 index 3f9a5e681d2758db56d1720f064728193d7bda12..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets +++ /dev/null @@ -1,134 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct EllipseExample { - - onActive(){ - console.log("lifecycle-->onActive") - } - onInactive(){ - console.log("lifecycle-->onInactive") - } - onShow(){ - console.log("lifecycle-->onShow") - } - onCastTempToNormal(){ - console.log("lifecycle-->onCastTempToNormal") - } - onVisibilityChanged(){ - console.log("lifecycle-->onVisibilityChanged") - } - onTriggerEvent(){ - console.log("lifecycle-->onTriggerEvent") - } - onDelete(){ - console.log("lifecycle-->onDelete") - } - onAcquireFormState(){ - console.log("lifecycle-->onAcquireFormState") - } - onHide(){ - console.log("lifecycle-->onHide") - } - onWindowDisplayModeChanged(){ - console.log("lifecycle-->onWindowDisplayModeChanged") - } - onStartContinuation(){ - console.log("lifecycle-->onStartContinuation") - } - onSaveData(){ - console.log("lifecycle-->onSaveData") - } - onCompleteContinuation(){ - console.log("lifecycle-->onCompleteContinuation") - } - onRestoreData(){ - console.log("lifecycle-->onRestoreData") - } - onRemoteTerminated(){ - console.log("lifecycle-->onRemoteTerminated") - } - onSaveAbilityState(){ - console.log("lifecycle-->onSaveAbilityState") - } - onRestoreAbilityState(){ - console.log("lifecycle-->onRestoreAbilityState") - } - onInactive(){ - console.log("lifecycle-->onInactive") - } - onActive(){ - console.log("lifecycle-->onActive") - } - onNewWant(){ - console.log("lifecycle-->onNewWant") - } - onMemoryLevel(){ - console.log("lifecycle-->onMemoryLevel") - } - onCommand(){ - console.log("lifecycle-->onCommand") - } - onStop(){ - console.log("lifecycle-->onStop") - } - onConnect(){ - console.log("lifecycle-->onConnect") - } - onDisconnect(){ - console.log("lifecycle-->onDisconnect") - } - onReconnect(){ - console.log("lifecycle-->onReconnect") - } - update(){ - console.log("lifecycle-->update") - } - normalizeUri(){ - console.log("lifecycle-->normalizeUri") - } - batchInsert(){ - console.log("lifecycle-->batchInsert") - } - denormalizeUri(){ - console.log("lifecycle-->denormalizeUri") - } - openFile(){ - console.log("lifecycle-->openFile") - } - getFileTypes(){ - console.log("lifecycle-->getFileTypes") - } - onInitialized(){ - console.log("lifecycle-->onInitialized") - } - getType(){ - console.log("lifecycle-->getType") - } - - build(){ - Column(){ - Button('click') - .key('button') - .backgroundColor('#FF0B8FE2') - .fontSize(20) - .margin({top: 20}) - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/list.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/list.ets index 91c7239b387e3ca170e56b78a1bd8d044718634b..ac5a3f49b045676982a786f1b1baa4d257f6fc1b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/list.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/list.ets @@ -1,125 +1,126 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct ListExample { - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - @State listDirection: Axis = Axis.Vertical; - @State editMode: boolean = false; - @State edgeEffect: EdgeEffect = EdgeEffect.None; - @State chainAnimation: boolean = false; - @State strokeWidth: number = 2.000000; - @State color: string = 0xFFFFFF; - @State startMargin: number = 20.000000; - @State endMargin: number = 20.000000; - - onPageShow() { - console.info('[list] page show called'); - var stateChangeEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - - var stateChangeEventTwo = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo); - } - - private stateChangCallBack = (eventData) => { - console.info("[stateChangCallBack] stateChangCallBack"); - if (eventData != null) { - console.info("[stateChangCallBack] state change called:" + JSON.stringify(eventData)); - if(eventData.data.listDirection != null) { - this.listDirection = eventData.data.listDirection; - } - if(eventData.data.editMode != null) { - this.editMode = eventData.data.editMode; - } - if(eventData.data.edgeEffect != null) { - this.edgeEffect = eventData.data.edgeEffect; - } - if(eventData.data.chainAnimation != null) { - this.chainAnimation = eventData.data.chainAnimation; - } - } - } - - private stateChangCallBackTwo = (eventData) => { - console.info("[stateChangCallBackTwo] stateChangCallBack"); - if (eventData != null) { - console.info("[stateChangCallBackTwo] state change called:" + JSON.stringify(eventData)); - if(eventData.data.strokeWidth != null) { - this.strokeWidth = eventData.data.strokeWidth; - } - if(eventData.data.color != null) { - this.color = eventData.data.color; - } - if(eventData.data.startMargin != null) { - this.startMargin = eventData.data.startMargin; - } - if(eventData.data.endMargin != null) { - this.endMargin = eventData.data.endMargin; - } - } - } - - build() { - Stack({ alignContent: Alignment.TopStart }) { - Column() { - List({ space: 20, initialIndex: 0 }) { - ForEach(this.arr, (item) => { - ListItem() { - Text('' + item) - .width('100%').height(100).fontSize(16) - .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) - }.editable(true) - }, item => item) - } - .key('list') - .listDirection(this.listDirection) - .divider({ strokeWidth: this.strokeWidth, color: this.color, startMargin: this.startMargin, endMargin: this.endMargin }) - .edgeEffect(this.edgeEffect) - .chainAnimation(this.chainAnimation) - .multiSelectable(true) - .onScrollIndex((firstIndex: number, lastIndex: number) => { - console.info('first' + firstIndex) - console.info('last' + lastIndex) - }) - .onScroll((scrollOffset: number, scrollState: ScrollState) => { - console.info('scrollOffset:' + scrollOffset) - console.info('scrollState:' + scrollState) - }) - .editMode(this.editMode) - .onItemDelete((index: number) => { - console.info(this.arr[index] + 'Delete') - this.arr.splice(index, 1) - console.info(JSON.stringify(this.arr)) - this.editFlag = false - return true - }).width('90%') - }.width('100%') - Button('edit list') - .onClick(() => { - this.editMode = !this.editMode - }).margin({ top: 5, left: 20 }) - }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct ListExample { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State listDirection: Axis = Axis.Vertical; + @State editMode: boolean = false; + @State edgeEffect: EdgeEffect = EdgeEffect.None; + @State chainAnimation: boolean = false; + @State strokeWidth: number = 2.000000; + @State color: string = 0xFFFFFF; + @State startMargin: number = 20.000000; + @State endMargin: number = 20.000000; + + onPageShow() { + console.info('[list] page show called'); + var stateChangeEvent = { + eventId: 124, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEventTwo = { + eventId: 125, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo); + } + + private stateChangCallBack = (eventData) => { + console.info("[stateChangCallBack] stateChangCallBack"); + if (eventData != null) { + console.info("[stateChangCallBack] state change called:" + JSON.stringify(eventData)); + if(eventData.data.listDirection != null) { + this.listDirection = eventData.data.listDirection; + } + if(eventData.data.editMode != null) { + this.editMode = eventData.data.editMode; + } + if(eventData.data.edgeEffect != null) { + this.edgeEffect = eventData.data.edgeEffect; + } + if(eventData.data.chainAnimation != null) { + this.chainAnimation = eventData.data.chainAnimation; + } + } + } + + private stateChangCallBackTwo = (eventData) => { + console.info("[stateChangCallBackTwo] stateChangCallBack"); + if (eventData != null) { + console.info("[stateChangCallBackTwo] state change called:" + JSON.stringify(eventData)); + if(eventData.data.strokeWidth != null) { + this.strokeWidth = eventData.data.strokeWidth; + } + if(eventData.data.color != null) { + this.color = eventData.data.color; + } + if(eventData.data.startMargin != null) { + this.startMargin = eventData.data.startMargin; + } + if(eventData.data.endMargin != null) { + this.endMargin = eventData.data.endMargin; + } + } + } + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + }.editable(true) + }, item => item) + } + .key('list') + .listDirection(this.listDirection) + .divider({ strokeWidth: this.strokeWidth, color: this.color, startMargin: this.startMargin, endMargin: this.endMargin }) + .edgeEffect(this.edgeEffect) + .chainAnimation(this.chainAnimation) + .multiSelectable(true) + .onScrollIndex((firstIndex: number, lastIndex: number) => { + console.info('first' + firstIndex) + console.info('last' + lastIndex) + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + console.info('scrollOffset:' + scrollOffset) + console.info('scrollState:' + scrollState) + }) + .editMode(this.editMode) + .onItemDelete((index: number) => { + console.info(this.arr[index] + 'Delete') + this.arr.splice(index, 1) + console.info(JSON.stringify(this.arr)) + this.editFlag = false + return true + }).width('90%') + }.width('100%') + Button('edit list') + .onClick(() => { + this.editMode = !this.editMode + }).margin({ top: 5, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/marquee.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/marquee.ets index ecec05bc7316dcb4647913ec09169a0c733cc476..1db3abe5e2b96e912af1e683afcd04f95d673e7a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/marquee.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/marquee.ets @@ -1,132 +1,133 @@ -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct MarqueeExample { - @State start: boolean = false - @State fromStart: boolean = true - @State step: number = 50 - @State loop: number = 3 - @State src: string = "Running Marquee starts rolling" - @State fontColor: Color = Color.Blue; - @State fontSize: number = 50; - @State onActionCalledThree: boolean = false; - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Marquee({ - start: this.start, - step: this.step, - loop: this.loop, - fromStart: this.fromStart, - src: this.src - }) - .key('marquee') - .fontColor(this.fontColor) - .colorBlend(Color.Green) - .fontSize(this.fontSize) - .allowScale(false) - .fontWeight(FontWeight.Bold) - .backgroundColor(Color.Black) - .margin({bottom:40}) - .onStart(() => { - console.log('Marquee animation complete onStart') - console.info('Onstart current action state is: ' + this.fontColor); - try { - var backData = { - data: { - "fontColor": this.fontColor, - } - } - var backEvent = { - eventId: 11, - priority: events_emitter.EventPriority.LOW - } - console.info("Onstart start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("Onstart emit action state err: " + JSON.stringify(err.message)) - } - }) - .onBounce(() => { - console.log('Marquee animation complete onBounce') - console.info('Onbounce current action state is: ' + this.fontSize); - try { - var backData = { - data: { - "fontSize": this.fontSize, - } - } - var backEvent = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - console.info("Onbounce start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("Onbounce emit action state err: " + JSON.stringify(err.message)) - } - }) - .onFinish(() => { - console.log('Marquee animation complete onFinish') - this.onActionCalledThree = true; - console.info('Onfinish current action state is: ' + this.onActionCalledThree); - try { - var backData = { - data: { - "ACTION": this.onActionCalledThree, - } - } - var backEvent = { - eventId: 16, - priority: events_emitter.EventPriority.LOW - } - console.info("Onfinish start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("Onfinish emit action state err: " + JSON.stringify(err.message)) - } - }) - Button('start') - .key('button') - .onClick(() => { - this.start = true - try { - var backData = { - data: { - "start": this.start, - } - } - var backEvent = { - eventId: 10, - priority: events_emitter.EventPriority.LOW - } - console.info("start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("emit action state err: " + JSON.stringify(err.message)) - } - }) - .width(200) - .height(60) - .margin({bottom:20}) - } - .width('100%') - .height('100%') - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct MarqueeExample { + @State start: boolean = false + @State fromStart: boolean = true + @State step: number = 50 + @State loop: number = 3 + @State src: string = "Running Marquee starts rolling" + @State fontColor: Color = Color.Blue; + @State fontSize: number = 50; + @State onActionCalledThree: boolean = false; + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Marquee({ + start: this.start, + step: this.step, + loop: this.loop, + fromStart: this.fromStart, + src: this.src + }) + .key('marquee') + .fontColor(this.fontColor) + .colorBlend(Color.Green) + .fontSize(this.fontSize) + .allowScale(false) + .fontWeight(FontWeight.Bold) + .backgroundColor(Color.Black) + .margin({bottom:40}) + .onStart(() => { + console.log('Marquee animation complete onStart') + console.info('Onstart current action state is: ' + this.fontColor); + try { + var backData = { + data: { + "fontColor": this.fontColor, + } + } + var backEvent = { + eventId: 127, + priority: events_emitter.EventPriority.LOW + } + console.info("Onstart start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Onstart emit action state err: " + JSON.stringify(err.message)) + } + }) + .onBounce(() => { + console.log('Marquee animation complete onBounce') + console.info('Onbounce current action state is: ' + this.fontSize); + try { + var backData = { + data: { + "fontSize": this.fontSize, + } + } + var backEvent = { + eventId: 128, + priority: events_emitter.EventPriority.LOW + } + console.info("Onbounce start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Onbounce emit action state err: " + JSON.stringify(err.message)) + } + }) + .onFinish(() => { + console.log('Marquee animation complete onFinish') + this.onActionCalledThree = true; + console.info('Onfinish current action state is: ' + this.onActionCalledThree); + try { + var backData = { + data: { + "ACTION": this.onActionCalledThree, + } + } + var backEvent = { + eventId: 129, + priority: events_emitter.EventPriority.LOW + } + console.info("Onfinish start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Onfinish emit action state err: " + JSON.stringify(err.message)) + } + }) + Button('start') + .key('button') + .onClick(() => { + this.start = true + try { + var backData = { + data: { + "start": this.start, + } + } + var backEvent = { + eventId: 130, + priority: events_emitter.EventPriority.LOW + } + console.info("start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("emit action state err: " + JSON.stringify(err.message)) + } + }) + .width(200) + .height(60) + .margin({bottom:20}) + } + .width('100%') + .height('100%') + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/overlay.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/overlay.ets index e35277bf4bdbcb73845040f8f5d80502861cec49..0ae9c25b98c7f5f86c7003b945f3b84d9eb17534 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/overlay.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/overlay.ets @@ -1,69 +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. - */ - -import events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct OverlayExample { - @State title: string = 'old title' - @State x: number = 0 - @State y: number = -15 - @State Alignment: Alignment = Alignment.Bottom - - onPageShow() { - console.info('[overlay] page show called '); - var stateChangeEvent = { - eventId: 83, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - private stateChangCallBack = (eventData) => { - console.info("[stateChangCallBack] stateChangCallBack "); - if (eventData != null) { - console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); - if (eventData.data.title != null) { - this.title = eventData.data.title - } - if (eventData.data.x != null) { - this.x = eventData.data.x - } - if (eventData.data.y != null) { - this.y = eventData.data.y - } - if (eventData.data.align != null) { - this.Alignment = eventData.data.align - } - } - } - - build() { - Column() { - Column() { - Text('floating layer') - .fontSize(12).fontColor(0xCCCCCC).maxLines(1) - Column() { - Image('/images/img.jpeg') - .width(340).height(240) - .key('overlay') - .overlay(this.title, - { align: this.Alignment, offset: { x: this.x, y: this.y } }) - }.border({ color: Color.Black, width: 2 }) - }.width('100%') - }.padding({ top: 20 }) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct OverlayExample { + @State title: string = 'old title' + @State x: number = 0 + @State y: number = -15 + @State alignment: Alignment = Alignment.Bottom + + onPageShow() { + console.info('[overlay] page show called '); + var stateChangeEvent = { + eventId: 143, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[stateChangCallBack] stateChangCallBack "); + if (eventData != null) { + console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); + if (eventData.data.align != null) { + this.alignment = eventData.data.align + } + if (eventData.data.title != null) { + this.title = eventData.data.title + } + if (eventData.data.x != null) { + this.x = eventData.data.x + } + if (eventData.data.y != null) { + this.y = eventData.data.y + } + + } + } + + build() { + Column() { + Column() { + Text('floating layer') + .fontSize(12).fontColor(0xCCCCCC).maxLines(1) + Column() { + Image('/images/img.jpeg') + .width(340).height(240) + .key('overlay') + .overlay(this.title, + { align: this.alignment, offset: { x: this.x, y: this.y } }) + }.border({ color: Color.Black, width: 2 }) + }.width('100%') + }.padding({ top: 20 }) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pinchGestureInterface.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pinchGestureInterface.ets deleted file mode 100755 index ac6e29616e80f92bd3ef813fcef5c77d4248d280..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pinchGestureInterface.ets +++ /dev/null @@ -1,42 +0,0 @@ -// @ts-nocheck -/** - * 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 PinchGestureExample { - @State scale: number = 1 - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Text('PinchGesture scale:' + this.scale) - } - .key('pinchGesture') - .height(100).width(200).padding(20).border({ width: 1 }).margin(80) - .scale({ x: this.scale, y: this.scale, z: this.scale }) - .gesture( - PinchGesture() - .onActionStart((event: GestureEvent) => { - console.info('Pinch start') - }) - .onActionUpdate((event: GestureEvent) => { - this.scale = event.scale - }) - .onActionEnd(() => { - console.info('Pinch end') - }) - ) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rotationGestureInterface.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rotationGestureInterface.ets deleted file mode 100755 index ddedf4befbb996021857c85ce425e93e07bac32c..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rotationGestureInterface.ets +++ /dev/null @@ -1,42 +0,0 @@ -// @ts-nocheck -/** - * 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 RotationGestureExample { - @State angle: number = 0 - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Text('RotationGesture angle:' + this.angle) - } - .key('rotationGesture') - .height(100).width(200).padding(20).border({ width:1 }) - .margin(80).rotate({ x:1, y:2, z:3, angle: this.angle }) - .gesture( - RotationGesture() - .onActionStart((event: GestureEvent) => { - console.log('Rotation start') - }) - .onActionUpdate((event: GestureEvent) => { - this.angle = event.angle - }) - .onActionEnd(() => { - console.log('Rotation end') - }) - ) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets deleted file mode 100755 index 0d3855cb125ec9295cf1bdcfee4e98043e14cde4..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets +++ /dev/null @@ -1,107 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct StyleExample { - @State isEnable: boolean = true - - @Styles pressedStyles() { - .backgroundColor("#ED6F21") - .borderRadius(10) - .borderStyle(BorderStyle.Dashed) - .borderWidth(2) - .borderColor("#33000000") - .width(120) - .height(30) - .opacity(1) - } - - @Styles disabledStyles() { - .backgroundColor("#E5E5E5") - .borderRadius(10) - .borderStyle(BorderStyle.Solid) - .borderWidth(2) - .borderColor("#2a4c1919") - .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() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { - Text("normal") - .fontSize(14) - .fontColor(Color.White) - .opacity(0.5) - .stateStyles({ - normal: this.normalStyles, - }) - .margin({ bottom: 20 }) - .textAlign(TextAlign.Center) - 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) - Text(this.isEnable == true ? "effective" : "disabled") - .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({ - disabled: this.disabledStyles, - }) - .textAlign(TextAlign.Center) - Text("control disabled") - .onClick(() => { - this.isEnable = !this.isEnable - console.log(`${this.isEnable}`) - }) - } - .width(350).height(300) - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stepper.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stepper.ets index 01c2c797db62e0a3ac306ff6dda0078ea5a8aaf8..86c5db9b37b6fbdbe65f40c212cadc26e713cfe1 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stepper.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stepper.ets @@ -1,118 +1,120 @@ -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct StepperExample { - @State currentIndex: number = 0 - @State firstState: ItemState = ItemState.Normal - @State secondState: ItemState = ItemState.Normal - @State disabled: ItemState = ItemState.Normal - - build() { - Stepper({ - index: this.currentIndex - }) { - StepperItem() { - Text('Page One') - .fontSize(35) - .fontColor(Color.Blue) - .width(200) - .lineHeight(50) - .margin({top:250}) - } - .nextLabel('') - .position({x: '35%', y: 0}) - .key('stepperItem1') - StepperItem() { - Text('Page Two') - .fontSize(35) - .fontColor(Color.Blue) - .width(200) - .lineHeight(50) - .margin({top:250}) - .key('text1') - .onClick(()=>{ - this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip - }) - } - .nextLabel('Next') - .prevLabel('Previous') - .status(this.firstState) - .position({x: '35%', y: 0}) - .key('stepperItem2') - StepperItem() { - Text('Page Three') - .fontSize(35) - .fontColor(Color.Blue) - .width(200) - .lineHeight(50) - .margin({top:250}) - .key('text2') - .onClick(()=>{ - this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting - }) - } - .position({x: '35%', y: 0}) - .status(this.secondState) - .key('stepperItem3') - StepperItem() { - Text('Page four') - .fontSize(35) - .fontColor(Color.Blue) - .width(200) - .lineHeight(50) - .margin({top:250}) - } - .position({x: '35%', y: 0}) - .nextLabel('Finish') - .key('stepperItem4') - } - .onFinish(() => { - console.log('onFinish') - }) - .onSkip(() => { - console.log('onSkip') - }) - .onChange((prevIndex: number, index: number) => { - this.currentIndex = index - }) - .align(Alignment.Center) - .key('stepper') - } - - onPageShow() { - console.info('stepper page show called'); - var stateChangeEvent = { - eventId: 12, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - console.info("stepper page stateChangCallBack" + JSON.stringify(eventData)); - if (eventData != null) { - console.info("stepper page state change called:" + JSON.stringify(eventData)); - if(eventData.data.currentIndex != null) { - this.currentIndex = parseInt(eventData.data.currentIndex); - } - if(eventData.data.disabled != null) { - this.disabled = eventData.data.disabled; - } - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct StepperExample { + @State currentIndex: number = 0 + @State firstState: ItemState = ItemState.Normal + @State secondState: ItemState = ItemState.Normal + @State disabled: ItemState = ItemState.Normal + + build() { + Stepper({ + index: this.currentIndex + }) { + StepperItem() { + Text('Page One') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({top:250}) + } + .nextLabel('') + .position({x: '35%', y: 0}) + .key('stepperItem1') + StepperItem() { + Text('Page Two') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({top:250}) + .key('text1') + .onClick(()=>{ + this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip + }) + } + .nextLabel('Next') + .prevLabel('Previous') + .status(this.firstState) + .position({x: '35%', y: 0}) + .key('stepperItem2') + StepperItem() { + Text('Page Three') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({top:250}) + .key('text2') + .onClick(()=>{ + this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting + }) + } + .position({x: '35%', y: 0}) + .status(this.secondState) + .key('stepperItem3') + StepperItem() { + Text('Page four') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({top:250}) + } + .position({x: '35%', y: 0}) + .nextLabel('Finish') + .key('stepperItem4') + } + .onFinish(() => { + console.log('onFinish') + }) + .onSkip(() => { + console.log('onSkip') + }) + .onChange((prevIndex: number, index: number) => { + this.currentIndex = index + }) + .align(Alignment.Center) + .key('stepper') + } + + onPageShow() { + console.info('stepper page show called'); + var stateChangeEvent = { + eventId: 202, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack) + } + + private stateChangCallBack = (eventData) => { + console.info("stepper page stateChangCallBack" + JSON.stringify(eventData)); + if (eventData != null) { + console.info("stepper page state change called:" + JSON.stringify(eventData)); + if(eventData.data.currentIndex != null) { + this.currentIndex = parseInt(eventData.data.currentIndex); + } + if(eventData.data.disabled != null) { + this.disabled = eventData.data.disabled; + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swipeDirection.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swipeDirection.ets deleted file mode 100755 index 40553dc9833e320801125e80b694ea99cdea2011..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swipeDirection.ets +++ /dev/null @@ -1,64 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' -@Entry -@Component -struct PanGestureExample { - @State offsetX: number = 0 - @State offsetY: number = 0 - @State direction: PanDirection = All - - build() { - Flex({ direction: FlexDirection.Column, direction:this.direction, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) - } - .key('swipeDirection') - .height(100).width(200).padding(20).border({ width: 1 }).margin(80) - .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) - .gesture( - PanGesture({}) - .onActionStart((event: PanGestureEvent) => { - console.info('Pan start') - }) - .onActionUpdate((event: PanGestureEvent) => { - this.offsetX = event.offsetX - this.offsetY = event.offsetY - }) - .onActionEnd(() => { - console.info('Pan end') - }) - ) - } - - onPageShow() { - console.info('panDirection page show called'); - var stateChangeEvent = { - eventId: 167, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("panDirection page state change called:" + JSON.stringify(eventData)); - if (eventData.data.direction != null) { - this.direction = eventData.data.direction; - } - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets index e6457971bae2f4fdd14b520102d1eaf06f9a7377..2ecaf7cb66950621a1c5974205f8bad8ecc85f52 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -1,215 +1,223 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -class MyDataSource implements IDataSource { - private list: number[] = [] - private listener: DataChangeListener - - constructor(list: number[]) { - this.list = list - } - - totalCount(): number { - return this.list.length - } - - getData(index: number): any { - return this.list[index] - } - - registerDataChangeListener(listener: DataChangeListener): void { - this.listener = listener - } - - unregisterDataChangeListener() { - } -} - -@Entry -@Component -struct SwiperExample { - private swiperController: SwiperController = new SwiperController() - private data: MyDataSource = new MyDataSource([]) - @State index: number = 1 - @State autoPlay: boolean = true - @State interval: number = 4000 - @State indicator: boolean = true - @State loop: boolean = false - @State duration: number = 1000 - @State vertical: boolean = false - @State itemSpace: number = 0 - @State onActionCalledOne: boolean = false; - @State onActionCalledTwo: boolean = false; - @State onActionCalledThree: boolean = false; - - private aboutToAppear(): void { - let list = [] - for (var i = 1; i <= 10; i++) { - list.push(i.toString()); - } - this.data = new MyDataSource(list) - } - - build() { - Column({ space: 5 }) { - Swiper(this.swiperController) { - LazyForEach(this.data, (item: string) => { - Text(item) - .width('90%') - .height(160) - .backgroundColor(0xAFEEEE) - .textAlign(TextAlign.Center) - .fontSize(20) - }, item => item) - } - .cachedCount(2) - .index(this.index) - .autoPlay(this.autoPlay) - .interval(this.interval) - .indicator(this.indicator) - .loop(this.loop) - .duration(this.duration) - .vertical(this.vertical) - .itemSpace(this.itemSpace) - .key('swiper') - .onChange((index: number) => { - console.info(index.toString()) - this.onActionCalledThree = true; - console.info('onChange current action state is: ' + this.onActionCalledThree); - try { - var backData = { - data: { - "ACTION": this.onActionCalledThree, - } - } - var backEvent = { - eventId: 20, - priority: events_emitter.EventPriority.LOW - } - console.info("onChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onChange emit action state err: " + JSON.stringify(err.message)) - } - }) - - Flex({ justifyContent: FlexAlign.SpaceAround }) { - Button('next') - .key('button1') - .onClick(() => { - this.swiperController.showNext(); - this.onActionCalledOne = true; - console.info('button1 current action state is: ' + this.onActionCalledOne); - try { - var backData = { - data: { - "ACTION": this.onActionCalledOne, - } - } - var backEvent = { - eventId: 18, - priority: events_emitter.EventPriority.LOW - } - console.info("button1 start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("button1 emit action state err: " + JSON.stringify(err.message)) - } - }) - Button('preview') - .key('button2') - .onClick(() => { - this.swiperController.showPrevious() - this.onActionCalledTwo = true; - console.info('button2 current action state is: ' + this.onActionCalledTwo); - try { - var backData = { - data: { - "ACTION": this.onActionCalledTwo, - } - } - var backEvent = { - eventId: 19, - priority: events_emitter.EventPriority.LOW - } - console.info("button2 start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("button2 emit action state err: " + JSON.stringify(err.message)) - } - }) - } - }.margin({ top: 5 }) - } - - onPageShow() { - console.info('swiper page show called'); - var stateChangeEvent = { - eventId: 17, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - - var stateChangeEventOne = { - eventId: 55, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventOne, this.stateChangCallBack) - - var stateChangeEventTwo = { - eventId: 56, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) - - var stateChangeEventTwo = { - eventId: 57, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("swiper page state change called:" + JSON.stringify(eventData)); - if (eventData.data.index != null) { - this.index = parseInt(eventData.data.index); - } - if (eventData.data.autoPlay != null) { - this.autoPlay = eventData.data.autoPlay; - } - if (eventData.data.interval != null) { - this.interval = parseInt(eventData.data.interval); - } - if (eventData.data.indicator != null) { - this.indicator = eventData.data.indicator; - } - if (eventData.data.loop != null) { - this.loop = eventData.data.loop; - } - if (eventData.data.duration != null) { - this.duration = parseInt(eventData.data.duration); - } - if (eventData.data.vertical != null) { - this.vertical = eventData.data.vertical; - } - if (eventData.data.itemSpace != null) { - this.itemSpace = parseInt(eventData.data.itemSpace); - } - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +class MyDataSource implements IDataSource { + private list: number[] = [] + private listener: DataChangeListener + + constructor(list: number[]) { + this.list = list + } + + totalCount(): number { + return this.list.length + } + + getData(index: number): any { + return this.list[index] + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener + } + + unregisterDataChangeListener() { + } +} + +@Entry +@Component +struct SwiperExample { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + @State index: number = 1 + @State displayCount: number = 3 + @State displayMode: number = SwiperDisplayMode.AutoLinear + @State edgeEffect: number = EdgeEffect.None + @State autoPlay: boolean = true + @State interval: number = 4000 + @State indicator: boolean = true + @State loop: boolean = false + @State duration: number = 1000 + @State vertical: boolean = false + @State itemSpace: number = 0 + @State onActionCalledOne: boolean = false; + @State onActionCalledTwo: boolean = false; + @State onActionCalledThree: boolean = false; + + private aboutToAppear(): void { + let list = [] + for (var i = 1; i <= 10; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + build() { + Column({ space: 5 }) { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(20) + }, item => item) + } + .cachedCount(2) + .index(this.index) + .autoPlay(this.autoPlay) + .interval(this.interval) + .indicator(this.indicator) + .loop(this.loop) + .duration(this.duration) + .vertical(this.vertical) + .itemSpace(this.itemSpace) + .displayMode(this.displayMode) + .displayCount(this.displayCount) + .effectMode(this.edgeEffect) + .indicatorStyle({ top: 20, right: 20,size:2,color: Color.Blue}) + .key('swiper') + .onChange((index: number) => { + console.info(index.toString()) + this.onActionCalledThree = true; + console.info('onChange current action state is: ' + this.onActionCalledThree); + try { + var backData = { + data: { + "ACTION": this.onActionCalledThree, + } + } + var backEvent = { + eventId: 204, + priority: events_emitter.EventPriority.LOW + } + console.info("onChange start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onChange emit action state err: " + JSON.stringify(err.message)) + } + }) + + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('next') + .key('button1') + .onClick(() => { + this.swiperController.showNext(); + this.onActionCalledOne = true; + console.info('button1 current action state is: ' + this.onActionCalledOne); + try { + var backData = { + data: { + "ACTION": this.onActionCalledOne, + } + } + var backEvent = { + eventId: 205, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + }) + Button('preview') + .key('button2') + .onClick(() => { + this.swiperController.showPrevious() + this.onActionCalledTwo = true; + console.info('button2 current action state is: ' + this.onActionCalledTwo); + try { + var backData = { + data: { + "ACTION": this.onActionCalledTwo, + } + } + var backEvent = { + eventId: 206, + priority: events_emitter.EventPriority.LOW + } + console.info("button2 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button2 emit action state err: " + JSON.stringify(err.message)) + } + }) + } + }.margin({ top: 5 }) + } + + onPageShow() { + console.info('swiper page show called'); + var stateChangeEvent = { + eventId: 207, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack) + + var stateChangeEventOne = { + eventId: 208, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventOne, this.stateChangCallBack) + + var stateChangeEventTwo = { + eventId: 209, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) + + var stateChangeEventTwo = { + eventId: 210, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) + } + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("swiper page state change called:" + JSON.stringify(eventData)); + if (eventData.data.index != null) { + this.index = parseInt(eventData.data.index); + } + if (eventData.data.autoPlay != null) { + this.autoPlay = eventData.data.autoPlay; + } + if (eventData.data.interval != null) { + this.interval = parseInt(eventData.data.interval); + } + if (eventData.data.indicator != null) { + this.indicator = eventData.data.indicator; + } + if (eventData.data.loop != null) { + this.loop = eventData.data.loop; + } + if (eventData.data.duration != null) { + this.duration = parseInt(eventData.data.duration); + } + if (eventData.data.vertical != null) { + this.vertical = eventData.data.vertical; + } + if (eventData.data.itemSpace != null) { + this.itemSpace = parseInt(eventData.data.itemSpace); + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textInput.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textInput.ets deleted file mode 100755 index 3fce754051dcbb1b246f38e1688f05c5f5a2751f..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textInput.ets +++ /dev/null @@ -1,146 +0,0 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct TextAreaExample2 { - @State text: string = 'TextInput'; - @State InputType: InputType = InputType.Normal; - @State fontSize: number = 30; - @State fontColor: string = Color.Red; - @State textAlign: string = TextAlign.Center; - @State InputType: InputType = InputType.Normal; - - onPageShow() { - console.info('swiper page show called'); - var stateChangeEvent = { - eventId: 1315, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - - var stateChangeEventOne = { - eventId: 1116, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventOne, this.stateChangCallBack) - - var stateChangeEventTwo = { - eventId: 1117, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) - - var stateChangeEventThree = { - eventId: 1118, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventThree, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("swiper page state change called:" + JSON.stringify(eventData)); - if (eventData.data.fontSize != null) { - this.fontSize = parseInt(eventData.data.fontSize); - } - if (eventData.data.fontColor != null) { - this.fontColor = eventData.data.fontColor; - } - if (eventData.data.textAlign != null) { - this.textAlign = eventData.data.textAlign; - } - if (eventData.data.type != null) { - this.InputType = eventData.data.type; - } - if (eventData.data.Text != null) { - this.Text = eventData.data.text; - } - } - } - - build() { - Column() { - TextArea({ placeholder: 'input your word' }) - .key('TextInput') - .type(this.InputType) - .placeholderColor("rgb(0,0,225)") - .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) - .textAlign(this.textAlign) - .caretColor(Color.Blue) - .height(50) - .fontSize(this.fontSize) - .fontWeight(FontWeight.Bold) - .fontFamily("sans-serif") - .fontStyle(FontStyle.Normal) - .fontColor(this.fontColor) - .inputFilter('^[\u4E00-\u9FA5A-Za-z0-9_]+$',(value: string) => { - console.info("hyb"+value) - }) - .onChange((value: string) => { - this.text = value - }) - .onCut((value: string) => { - this.text = value - console.info(index.toString()) - this.onActionCalledOne = true; - console.info('onChange current action state is: ' + this.onActionCalledOne); - try { - var backData = { - data: { - "ACTION": this.onActionCalledOne, - } - } - var backEvent = { - eventId: 3022, - priority: events_emitter.EventPriority.LOW - } - console.info("onChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onChange emit action state err: " + JSON.stringify(err.message)) - } - }) - .onPaste((value: string) => { - this.text = value - console.info(index.toString()) - this.onActionCalledTwo = true; - console.info('onChange current action state is: ' + this.onActionCalledTwo); - try { - var backData = { - data: { - "ACTION": this.onActionCalledTwo, - } - } - var backEvent = { - eventId: 3023, - priority: events_emitter.EventPriority.LOW - } - console.info("onChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onChange emit action state err: " + JSON.stringify(err.message)) - } - }) - Text(this.text).width('90%').key('text') - Button('caretPosition') - .onClick(() => { - this.controller.caretPosition(4) - }) - } - } -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/textStyle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textStyle.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/textStyle.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textStyle.ets index beb0ca9738e55f93a1923b7eb02cf345051deb52..0de318885b18f5e67ec9e02abbe0e9d2ad6fb03d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/textStyle.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textStyle.ets @@ -1,115 +1,116 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct TextStyle { - @State fontColor: Color = Color.Red; - @State fontSize: string = 20; - @State fontStyle: FontStyle = FontStyle.Italic; - @State fontWeight: string = 700; - @State fontFamily: string = 'sans-serif'; - - build() { - Column({ space: 20 }) { - Text('default text').fontSize(20) - - Text(`text font color ${this.fontColor}`) - .fontColor(this.fontColor) - .fontSize(20) - .key('fontColor') - - Text(`text font size ${this.fontSize}`) - .fontSize(this.fontSize) - .key('fontSize') - - Text(`text font style ${this.fontStyle}`) - .fontStyle(this.fontStyle) - .fontSize(20) - .key('fontStyle') - - Text(`text fontWeight ${this.fontWeight}`) - .fontWeight(this.fontWeight) - .fontSize(20) - .key('fontWeight') - - Text(`text fontFamily ${this.fontFamily}`) - .fontFamily(this.fontFamily) - .fontSize(20) - .key('fontFamily') - - Text('red 20 Italic bold cursive text') - .fontColor(Color.Red) - .fontSize(20) - .fontStyle(FontStyle.Italic) - .fontWeight(700) - .fontFamily('cursive') - .textAlign(TextAlign.Center) - .width('90%') - - Text('Orange 18 Normal source-sans-pro text') - .fontColor(Color.Orange) - .fontSize(20) - .fontStyle(FontStyle.Normal) - .fontWeight(400) - .fontFamily('source-sans-pro,cursive,sans-serif') - }.width('100%').margin({top: 20}) - } - onPageShow() { - let fontColorChangeEvent = { - eventId: 40, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(fontColorChangeEvent, this.textStyleChangCallBack); - let fontSizeChangeEvent = { - eventId: 41, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(fontSizeChangeEvent, this.textStyleChangCallBack); - let fontStyleChangeEvent = { - eventId: 42, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(fontStyleChangeEvent, this.textStyleChangCallBack); - let fontWeightChangeEvent = { - eventId: 43, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(fontWeightChangeEvent, this.textStyleChangCallBack); - let fontFamilyChangeEvent = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(fontFamilyChangeEvent, this.textStyleChangCallBack); - } - textStyleChangCallBack = (eventData) => { - console.info("textStyle page stateChangCallBack" + JSON.stringify(eventData)); - if (eventData && eventData.data) { - if (eventData.data.fontColor) { - this.fontColor = eventData.data.fontColor; - } else if (eventData.data.fontSize) { - this.fontSize = eventData.data.fontSize; - } else if (eventData.data.fontWeight) { - this.fontWeight = eventData.data.fontWeight; - } else if (eventData.data.fontFamily) { - this.fontFamily = eventData.data.fontFamily; - } else { - this.fontStyle = eventData.data.fontStyle; - } - } - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct TextStyle { + @State fontColor: Color = Color.Red; + @State fontSize: string = 20; + @State fontStyle: FontStyle = FontStyle.Italic; + @State fontWeight: string = 700; + @State fontFamily: string = 'sans-serif'; + + build() { + Column({ space: 20 }) { + Text('default text').fontSize(20) + + Text(`text font color ${this.fontColor}`) + .fontColor(this.fontColor) + .fontSize(20) + .key('fontColor') + + Text(`text font size ${this.fontSize}`) + .fontSize(this.fontSize) + .key('fontSize') + + Text(`text font style ${this.fontStyle}`) + .fontStyle(this.fontStyle) + .fontSize(20) + .key('fontStyle') + + Text(`text fontWeight ${this.fontWeight}`) + .fontWeight(this.fontWeight) + .fontSize(20) + .key('fontWeight') + + Text(`text fontFamily ${this.fontFamily}`) + .fontFamily(this.fontFamily) + .fontSize(20) + .key('fontFamily') + + Text('red 20 Italic bold cursive text') + .fontColor(Color.Red) + .fontSize(20) + .fontStyle(FontStyle.Italic) + .fontWeight(700) + .fontFamily('cursive') + .textAlign(TextAlign.Center) + .width('90%') + + Text('Orange 18 Normal source-sans-pro text') + .fontColor(Color.Orange) + .fontSize(20) + .fontStyle(FontStyle.Normal) + .fontWeight(400) + .fontFamily('source-sans-pro,cursive,sans-serif') + }.width('100%').margin({top: 20}) + } + onPageShow() { + let fontColorChangeEvent = { + eventId: 37, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(fontColorChangeEvent, this.textStyleChangCallBack); + let fontSizeChangeEvent = { + eventId: 38, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(fontSizeChangeEvent, this.textStyleChangCallBack); + let fontStyleChangeEvent = { + eventId: 39, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(fontStyleChangeEvent, this.textStyleChangCallBack); + let fontWeightChangeEvent = { + eventId: 40, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(fontWeightChangeEvent, this.textStyleChangCallBack); + let fontFamilyChangeEvent = { + eventId: 41, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(fontFamilyChangeEvent, this.textStyleChangCallBack); + } + textStyleChangCallBack = (eventData) => { + console.info("textStyle page stateChangCallBack" + JSON.stringify(eventData)); + if (eventData && eventData.data) { + if (eventData.data.fontColor) { + this.fontColor = eventData.data.fontColor; + } else if (eventData.data.fontSize) { + this.fontSize = eventData.data.fontSize; + } else if (eventData.data.fontWeight) { + this.fontWeight = eventData.data.fontWeight; + } else if (eventData.data.fontFamily) { + this.fontFamily = eventData.data.fontFamily; + } else { + this.fontStyle = eventData.data.fontStyle; + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touch.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touch.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets index 91498affb50102c0f1b6f239cdc797bf9ce71c0b..4fa1495acbde130413b871546eec2b4828db63bb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touch.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets @@ -1,108 +1,109 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Preview -@Component -struct TouchExample { - @State text: string = '' - @State eventType: string = '' - @State touchFlag: boolean = false - - onPageShow() { - console.info('[touch] page show called'); - var stateChangeEvent = { - eventId: 51, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - private stateChangCallBack = (eventData) => { - console.info("[touch] page stateChangCallBack"); - if (eventData != null) { - console.info("[touch] page state change called:" + JSON.stringify(eventData)); - if(eventData.data.text != null) { - this.text = eventData.data.text; - } - if(eventData.data.eventType != null) { - this.eventType = eventData.data.eventType; - } - if(eventData.data.touchFlag != null) { - this.touchFlag = eventData.data.touchFlag - } - } - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Button('Touch').backgroundColor(0x2788D9).height(40).width(80) - .key('touch') - .onTouch((event: Touch) => { - if (event.type === TouchType.Down) { - this.eventType = 'Down' - console.info("[touch] eventType is Down") - this.touchFlag = true - } - if (event.type === TouchType.Up) { - this.eventType = 'Up' - console.info("[touch] eventType is Up") - this.touchFlag = true - } - if (event.type === TouchType.Move) { - this.eventType = 'Move' - console.info("[touch] eventType is Move") - this.touchFlag = true - } - stopPropagation: () => { - console.info('stopPropagation') - } - console.info('onTouch successful, touchFlag is : ' + this.eventType + ', ' +this.touchFlag) - console.info(this.text = 'TouchType:' + this.eventType - + '\nDistance between touch point and touch element:\nx: ' - + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\ncomponent globalPos:(' - + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' - + event.target.area.width + '\nheight:' + event.target.area.height) - console.info(this.text = 'TouchType:' + this.eventType - + '\nDistance between touch point and touch element:\nx: ' - + event.changedTouches[0].x + '\n' + 'y: ' + event.changedTouches[0].y + '\ncomponent globalPos:(' - + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' - + event.target.area.width + '\nheight:' + event.target.area.height) - console.log('fang--->A') - try{ - console.log('fang--->B') - var backData = { - data: { - "ACTION": this.touchFlag, - } - } - console.log('fang--->C') - var backEvent = { - eventId: 51, - priority: events_emitter.EventPriority.LOW - } - console.log('fang--->D') - console.info("touchFlag start to emit action state") - events_emitter.emit(backEvent, backData) - }catch{ - console.info("touchFlag emit action state err: " + JSON.stringify(err.message)) - } - }) - Text(this.text) - }.height(200).width(350) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Preview +@Component +struct TouchExample { + @State text: string = '' + @State eventType: string = '' + @State touchFlag: boolean = false + + onPageShow() { + console.info('[touch] page show called'); + var stateChangeEvent = { + eventId: 42, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[touch] page stateChangCallBack"); + if (eventData != null) { + console.info("[touch] page state change called:" + JSON.stringify(eventData)); + if(eventData.data.text != null) { + this.text = eventData.data.text; + } + if(eventData.data.eventType != null) { + this.eventType = eventData.data.eventType; + } + if(eventData.data.touchFlag != null) { + this.touchFlag = eventData.data.touchFlag + } + } + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Button('Touch').backgroundColor(0x2788D9).height(40).width(80) + .key('touch') + .onTouch((event: Touch) => { + if (event.type === TouchType.Down) { + this.eventType = 'Down' + console.info("[touch] eventType is Down") + this.touchFlag = true + } + if (event.type === TouchType.Up) { + this.eventType = 'Up' + console.info("[touch] eventType is Up") + this.touchFlag = true + } + if (event.type === TouchType.Move) { + this.eventType = 'Move' + console.info("[touch] eventType is Move") + this.touchFlag = true + } + stopPropagation: () => { + console.info('stopPropagation') + } + console.info('onTouch successful, touchFlag is : ' + this.eventType + ', ' +this.touchFlag) + console.info(this.text = 'TouchType:' + this.eventType + + '\nDistance between touch point and touch element:\nx: ' + + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\ncomponent globalPos:(' + + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height) + console.info(this.text = 'TouchType:' + this.eventType + + '\nDistance between touch point and touch element:\nx: ' + + event.changedTouches[0].x + '\n' + 'y: ' + event.changedTouches[0].y + '\ncomponent globalPos:(' + + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height) + console.log('fang--->A') + try{ + console.log('fang--->B') + var backData = { + data: { + "ACTION": this.touchFlag, + } + } + console.log('fang--->C') + var backEvent = { + eventId: 43, + priority: events_emitter.EventPriority.LOW + } + console.log('fang--->D') + console.info("touchFlag start to emit action state") + events_emitter.emit(backEvent, backData) + }catch{ + console.info("touchFlag emit action state err: " + JSON.stringify(err.message)) + } + }) + Text(this.text) + }.height(200).width(350) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touchAble.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets similarity index 73% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touchAble.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets index 1a53693849e0a0a91edb68135ae707dca582d74d..5f1be1a1bf0d377368178b99288d5826bb3bc029 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/touchAble.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets @@ -1,62 +1,80 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct TouchAbleExample { - @State text1: string = ''; - @State text2: string = ''; - @State touchableValue: boolean = false; - - private stateChangCallBack = (eventData) => { - console.info("[TouchAble] page stateChangCallBack"); - if (eventData != null) { - console.info("[TouchAble] page state change called:" + JSON.stringify(eventData)); - if (eventData.data.touchableValue != null) { - this.touchableValue = eventData.data.touchableValue; - } - } - } - - onPageShow() { - console.info('[TouchAble] page show called'); - var stateChangeEvent = { - eventId: 50, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } - - build() { - Stack() { - Rect() - .fill(Color.Gray).width(150).height(150) - .onClick(() => { - console.info(this.text1 = 'Rect Clicked') - }) - .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) - Ellipse() - .fill(Color.Pink).width(150).height(80) - .key('ellipse') - .touchable(this.touchableValue) - .onClick(() => { - console.info(this.text2 = 'Ellipse Clicked') - }) - .overlay(this.text2, { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) - }.margin(100) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +@Preview +struct TouchAbleExample { + @State text1: string = ''; + @State text2: string = ''; + @State touchableValue: boolean = false; + + private stateChangCallBack = (eventData) => { + console.info("[TouchAble] page stateChangCallBack"); + if (eventData != null) { + console.info("[TouchAble] page state change called:" + JSON.stringify(eventData)); + if (eventData.data.touchableValue != null) { + this.touchableValue = eventData.data.touchableValue; + } + } + } + + onPageShow() { + console.info('[TouchAble] page show called'); + var stateChangeEvent = { + eventId: 44, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Stack() { + Rect() + .fill(Color.Gray).width(150).height(150) + .onClick(() => { + console.info(this.text1 = 'Rect Clicked') + }) + .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Ellipse() + .fill(Color.Pink).width(150).height(80) + .key('ellipse') + .touchable(this.touchableValue) + .onClick(() => { + this.text2 = 'Ellipse Clicked'; + console.info("touchAble text2:" + this.text2); + try { + var backData = { + data: { + "ACTION": this.text2 + } + } + var backEvent = { + eventId: 237, + priority: events_emitter.EventPriority.LOW + } + console.info("[TouchAble] start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("[TouchAble] emit action state err: " + JSON.stringify(err.message)) + } + }) + .overlay(this.text2, { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + }.margin(100) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/visibility.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/visibility.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets index f0efb90faafcc8c9741f1bebc363ae7937d1f94d..3d373657ff6ecb234c87e1a92028e2e9de139197 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/visibility.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets @@ -1,68 +1,69 @@ -// @ts-nocheck -/** - * 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 events_emitter from '@ohos.events.emitter'; - -@Entry -@Component -struct VisibilityExample { - @State visibility: Visibility = Visibility.Visible; - - onPageShow() { - let hiddenChangeEvent = { - eventId: 90, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(hiddenChangeEvent, this.hiddenChangCallBack) - - let noneChangeEvent = { - eventId: 91, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(noneChangeEvent, this.noneChangCallBack) - } - - private hiddenChangCallBack = (eventData) => { - console.info("[hiddenChangCallBack] stateChangCallBack"); - if (eventData != null) { - console.info("[hiddenChangCallBack] state change called:" + JSON.stringify(eventData)); - if(eventData.data.visibility != null) { - this.visibility = eventData.data.visibility; - } - } - } - - private noneChangCallBack = (eventData) => { - console.info("[noneChangCallBack] stateChangCallBack"); - if (eventData != null) { - console.info("[noneChangCallBack] state change called:" + JSON.stringify(eventData)); - if(eventData.data.visibility != null) { - this.visibility = eventData.data.visibility; - } - } - } - - build() { - Column() { - Column() { - Text('BoxOne').fontSize(9).width('90%').fontColor(0xCCCCCC) - Row().visibility(this.visibility).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20).key('box') - - Text('BoxTwo').fontSize(9).width('90%').fontColor(0xCCCCCC) - Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20) - }.width('90%').border({ width: 1 }) - }.width('100%').margin({ top: 5 }) - } -} +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct VisibilityExample { + @State visibility: Visibility = Visibility.Visible; + + onPageShow() { + let hiddenChangeEvent = { + eventId: 47, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(hiddenChangeEvent, this.hiddenChangCallBack) + + let noneChangeEvent = { + eventId: 48, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(noneChangeEvent, this.noneChangCallBack) + } + + private hiddenChangCallBack = (eventData) => { + console.info("[hiddenChangCallBack] stateChangCallBack"); + if (eventData != null) { + console.info("[hiddenChangCallBack] state change called:" + JSON.stringify(eventData)); + if(eventData.data.visibility != null) { + this.visibility = eventData.data.visibility; + } + } + } + + private noneChangCallBack = (eventData) => { + console.info("[noneChangCallBack] stateChangCallBack"); + if (eventData != null) { + console.info("[noneChangCallBack] state change called:" + JSON.stringify(eventData)); + if(eventData.data.visibility != null) { + this.visibility = eventData.data.visibility; + } + } + } + + build() { + Column() { + Column() { + Text('BoxOne').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row().visibility(this.visibility).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20).key('box') + + Text('BoxTwo').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20) + }.width('90%').border({ width: 1 }) + }.width('100%').margin({ top: 5 }) + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/zIndex.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/zIndex.ets index 888c6083008e4fa297d2aad2d12b46672c5ca4a1..173a8d29c0f6347fdbf82e17ea1a7d9998062e99 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/zIndex.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/zIndex.ets @@ -1,60 +1,62 @@ -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct zIndexExample { - @State zIndex: number = 1; - - onPageShow() { - console.info('[zIndex] page show called '); - var stateChangeEvent = { - eventId: 84, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - - } - - private stateChangCallBack = (eventData) => { - console.info("[stateChangCallBack] stateChangCallBack "); - if (eventData != null) { - console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); - if (eventData.data.zIndex != null) { - this.zIndex = eventData.data.zIndex - } - } - } - - build() { - Column() { - Stack() { - Text('first child, zIndex(2)') - .size({ width: '40%', height: '60%' }).backgroundColor(0xbbb2cb) - .zIndex(2) - Text('second child, default zIndex(0)') - .size({ width: '90%', height: '80%' }).backgroundColor(0xd2cab3).align(Alignment.TopStart) - Text('third child, zIndex(1)') - .size({ width: '70%', height: '50%' }) - .backgroundColor(0xc1cbac) - .align(Alignment.TopStart) - .zIndex(this.zIndex) - .key('zIndex') - } - }.width('100%').height(200) - } +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct zIndexExample { + @State zIndex: number = 1; + + onPageShow() { + console.info('[zIndex] page show called '); + var stateChangeEvent = { + eventId: 236, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + } + + private stateChangCallBack = (eventData) => { + console.info("[stateChangCallBack] stateChangCallBack "); + if (eventData != null) { + console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData)); + if (eventData.data.zIndex != null) { + this.zIndex = eventData.data.zIndex + } + } + } + + build() { + Column() { + Stack() { + Text('first child, zIndex(2)') + .size({ width: '40%', height: '60%' }).backgroundColor(0xbbb2cb) + .zIndex(2) + Text('second child, default zIndex(0)') + .size({ width: '90%', height: '80%' }).backgroundColor(0xd2cab3).align(Alignment.TopStart) + Text('third child, zIndex(1)') + .size({ width: '70%', height: '50%' }) + .backgroundColor(0xc1cbac) + .align(Alignment.TopStart) + .zIndex(this.zIndex) + .key('zIndex') + } + }.width('100%').height(200) + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets deleted file mode 100755 index 293156fa7c36c592bfb7102b0531ec5a061ab061..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets +++ /dev/null @@ -1,102 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function alphabetIndexerJsunit() { - describe('alphabetIndexerTest', function () { - beforeEach(async function (done) { - console.info("alphabetIndexer beforeEach start"); - let options = { - uri: 'pages/alphabetIndexer', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get alphabetIndexer state pages:" + JSON.stringify(pages)); - if (!("alphabetIndexer" == pages.name)) { - console.info("get alphabetIndexer state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push alphabetIndexer page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push alphabetIndexer page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("alphabetIndexer after each called"); - }); - - it('testAlphabetIndexer01', 0, async function (done) { - console.info('[testAlphabetIndexer01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('alphabetIndexer'); - let obj = JSON.parse(strJson); - console.info("[testAlphabetIndexer01] alphabetIndexer obj is: " + JSON.stringify(obj)); - let font = JSON.parse(obj.$attrs.font); - console.info("[testAlphabetIndexer01] font: " + JSON.stringify(font)); - expect(font.size).assertEqual(20); - expect(font.weight).assertEqual('FontWeight.Bolder'); - expect(font.family).assertEqual('sans-serif'); - expect(font.style).assertEqual('FontStyle.Italic'); - console.info('testAlphabetIndexer01 END'); - done(); - }); - - it('testAlphabetIndexer02', 0, async function (done) { - console.info('[testAlphabetIndexer02] START'); - try { - let obj = { - size: 25, - weight: 400, - family: 'Arial', - style: FontStyle.Normal - } - let eventData = { - data: { - "font": JSON.stringify(obj) - } - } - var innerEvent = { - eventId: 71, - priority: events_emitter.EventPriority.LOW - } - console.info("[testAlphabetIndexer02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testAlphabetIndexer02] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('alphabetIndexer'); - let objNew = JSON.parse(strJsonNew); - console.info("[testAlphabetIndexer02] alphabetIndexer obj is: " + JSON.stringify(objNew)); - let font = JSON.parse(objNew.$attrs.font); - console.info("[testAlphabetIndexer02] font: " + JSON.stringify(font)); - expect(font.size).assertEqual(25); - expect(font.weight).assertEqual("FontWeight.400"); - expect(font.family).assertEqual('Arial'); - expect(font.style).assertEqual('FontStyle.Normal'); - console.info('testAlphabetIndexer02 END'); - done(); - }); - }); -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets index 0d3da54799e402978dbfe1e0af0c97514bf0718b..61924c80e460650497bdebd7427118f3e001d6ba 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets @@ -1,108 +1,107 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; - -export default function appearJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("appear beforeEach start"); - let options = { - uri: 'pages/appear', - } - let result; - try { - router.clear(); - let pages = router.getState(); - console.info("get appear state pages: " + JSON.stringify(pages)); - if (!("appear" == pages.name)) { - console.info("get appear state pages.name: " + JSON.stringify(pages.name)); - result = await router.push(options); - await Utils.sleep(2000); - console.info("push appear page result: " + JSON.stringify(result)); - } - } catch (err) { - console.error("push appear page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("appear after each called"); - }) - - it('testAppear01', 0, async function (done) { - console.info('[testAppear01] START'); - await Utils.sleep(1000); - try { - let callBackAppear = (backData) => { - console.info("testAppear01 get appearEvent result is: " + JSON.stringify(appearEvent)); - expect(backData.data.ACTION).assertEqual(true); - } - var appearEvent = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(appearEvent, callBackAppear); - } catch (err) { - console.info("testAppear01 on appearEvent err : " + JSON.stringify(err)); - } - console.info("testAppear01 click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); - console.info('[testAppear01] END'); - done(); - }); - - it('testAppear02', 0, async function (done) { - console.info('[testAppear02] START'); - await Utils.sleep(1000); - try { - let callBackAppear = (backData) => { - console.info("testAppear02 get appearEvent result is: " + JSON.stringify(appearEvent)); - expect(backData.data.ACTION).assertEqual(true); - } - var appearEvent = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(appearEvent, callBackAppear); - } catch (err) { - console.info("testAppear02 on appearEvent err : " + JSON.stringify(err)); - } - console.info("testAppear02 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); - - try { - let callBackDisAppear = (backData) => { - console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(disAppearEvent)); - expect(backData.data.ACTION).assertEqual(true); - } - var disAppearEvent = { - eventId: 16, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(disAppearEvent, callBackDisAppear); - } catch (err) { - console.info("testAppear02 on disAppearEvent err : " + JSON.stringify(err)); - } - console.info("testAppear02 disAppearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); - console.info('[testAppear02] END'); - done(); - }); - - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; +export default function appearJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("appear beforeEach start"); + let options = { + uri: 'pages/appear', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get appear state pages: " + JSON.stringify(pages)); + if (!("appear" == pages.name)) { + console.info("get appear state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push appear page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push appear page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("appear after each called"); + }) + + it('testAppear01', 0, async function (done) { + console.info('[testAppear01] START'); + await Utils.sleep(1000); + try { + let callBackAppear = (backData) => { + console.info("testAppear01 get appearEvent result is: " + JSON.stringify(appearEvent)); + expect(backData.data.ACTION).assertEqual(true); + } + var appearEvent = { + eventId: 58, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(appearEvent, callBackAppear); + } catch (err) { + console.info("testAppear01 on appearEvent err : " + JSON.stringify(err)); + } + console.info("testAppear01 click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); + console.info('[testAppear01] END'); + done(); + }); + + it('testAppear02', 0, async function (done) { + console.info('[testAppear02] START'); + await Utils.sleep(1000); + try { + let callBackAppear = (backData) => { + console.info("testAppear02 get appearEvent result is: " + JSON.stringify(appearEvent)); + expect(backData.data.ACTION).assertEqual(true); + } + var appearEvent = { + eventId: 59, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(appearEvent, callBackAppear); + } catch (err) { + console.info("testAppear02 on appearEvent err : " + JSON.stringify(err)); + } + console.info("testAppear02 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); + + try { + let callBackDisAppear = (backData) => { + console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(disAppearEvent)); + expect(backData.data.ACTION).assertEqual(true); + } + var disAppearEvent = { + eventId: 60, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(disAppearEvent, callBackDisAppear); + } catch (err) { + console.info("testAppear02 on disAppearEvent err : " + JSON.stringify(err)); + } + console.info("testAppear02 disAppearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); + console.info('[testAppear02] END'); + done(); + }); + + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets index 6bf942edd193f8ba48e779c15a98b6ec7a1b7634..0715e4be526c2dfd5f5ffc467216792a745bbf4a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets @@ -1,130 +1,129 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; - -export default function areaChangeJsunit() { - describe('areaChange', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/areaChange', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get areaChange state success " + JSON.stringify(pages)); - if (!("areaChange" == pages.name)) { - console.info("get areaChange state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(1000); - console.info("push areaChange page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push areaChange page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("areaChange after each called"); - }); - - it('areaChangeTest_0100', 0, async function (done) { - console.info('areaChangeTest_0100 START'); - let strJson = getInspectorByKey('text1'); - console.info("areaChangeTest_0100 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("areaChangeTest_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.width).assertEqual('42.000000'); - expect(obj.$attrs.height).assertEqual('23.000000'); - console.info('areaChangeTest_0100 END'); - done(); - }); - - it('areaChangeTest_0200', 0, async function (done) { - console.info('areaChangeTest_0200 START'); - let strJson = getInspectorByKey('text2'); - console.info("areaChangeTest_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("areaChangeTest_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.width).assertEqual('409.000000'); - expect(obj.$attrs.height).assertEqual('175.000000'); - console.info('areaChangeTest_0200 END'); - done(); - }); - - it('areaChangeTest_0300', 0, async function (done) { - console.info('areaChangeTest_0300 START'); - await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.value).assertEqual('TextText'); - } - let indexEvent = { - eventId: 21, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); - } - console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, ""))); - var innerEventOne = { - eventId: 22, - priority: events_emitter.EventPriority.LOW - } - await Utils.sleep(1500); - var callback1 = (eventData) => { - console.info("areaChangeTest_0300 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true); - } - try { - events_emitter.on(innerEventOne, callback1); - } catch (err) { - console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); - } - console.info('areaChangeTest_0300 END'); - done(); - }); - - it('areaChangeTest_0400', 0, async function (done) { - console.info('areaChangeTest_0400 START'); - await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.value).assertEqual('TextTextText'); - } - let indexEvent = { - eventId: 21, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("areaChangeTest_0400 on events_emitter err : " + JSON.stringify(err)); - } - console.info("areaChangeTest_0400 click result is: " + JSON.stringify(sendEventByKey('text1',10,""))); - console.info('areaChangeTest_0400 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; +export default function areaChangeJsunit() { + describe('areaChange', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/areaChange', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get areaChange state success " + JSON.stringify(pages)); + if (!("areaChange" == pages.name)) { + console.info("get areaChange state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push areaChange page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push areaChange page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("areaChange after each called"); + }); + + it('areaChangeTest_0100', 0, async function (done) { + console.info('areaChangeTest_0100 START'); + let strJson = getInspectorByKey('text1'); + console.info("areaChangeTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("areaChangeTest_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual('42.000000'); + expect(obj.$attrs.height).assertEqual('23.000000'); + console.info('areaChangeTest_0100 END'); + done(); + }); + + it('areaChangeTest_0200', 0, async function (done) { + console.info('areaChangeTest_0200 START'); + let strJson = getInspectorByKey('text2'); + console.info("areaChangeTest_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("areaChangeTest_0200 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual('519.000000'); + expect(obj.$attrs.height).assertEqual('140.000000'); + console.info('areaChangeTest_0200 END'); + done(); + }); + + it('areaChangeTest_0300', 0, async function (done) { + console.info('areaChangeTest_0300 START'); + await Utils.sleep(1000); + let callback = (indexEvent) => { + console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.value).assertEqual('TextText'); + } + let indexEvent = { + eventId: 61, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, ""))); + var innerEventOne = { + eventId: 62, + priority: events_emitter.EventPriority.LOW + } + await Utils.sleep(1500); + var callback1 = (eventData) => { + console.info("areaChangeTest_0300 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info('areaChangeTest_0300 END'); + done(); + }); + + it('areaChangeTest_0400', 0, async function (done) { + console.info('areaChangeTest_0400 START'); + await Utils.sleep(1000); + let callback = (indexEvent) => { + console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.value).assertEqual('TextTextText'); + } + let indexEvent = { + eventId: 62, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("areaChangeTest_0400 on events_emitter err : " + JSON.stringify(err)); + } + console.info("areaChangeTest_0400 click result is: " + JSON.stringify(sendEventByKey('text1',10,""))); + console.info('areaChangeTest_0400 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets deleted file mode 100755 index 6c3f4519d99a74826cc7cff4397cc2161a36c3b8..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets +++ /dev/null @@ -1,58 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import Utils from './Utils'; - -export default function columnJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("column beforeEach start"); - let options = { - uri: 'pages/column', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get column state pages:" + JSON.stringify(pages)); - if (!("column" == pages.name)) { - console.info("get column state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push column page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push column page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("column after each called"); - }); - - it('testColumn01', 0, async function (done) { - console.info('[testColumn01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('column'); - let obj = JSON.parse(strJson); - console.info("[testColumn01] obj is: " + JSON.stringify(obj)); - console.info('[testColumn01] END'); - done(); - }); - }) -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets index 4cd05d34d21e075201dd1ec7d6544a6d53fd1d88..7f32a8378379b2a083f88f5099580e4cd5d584af 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets @@ -1,113 +1,113 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function ellipseJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("ellipse beforeEach start"); - let options = { - uri: 'pages/ellipse', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get ellipse state pages:" + JSON.stringify(pages)); - if (!("ellipse" == pages.name)) { - console.info("get ellipse state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push ellipse page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push ellipse page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("ellipse after each called"); - }); - - it('testEllipse01', 0, async function (done) { - console.info('[testEllipse01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('ellipse'); - let obj = JSON.parse(strJson); - console.info("[testEllipse02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.height).assertEqual('200.000000px'); - expect(obj.$attrs.width).assertEqual('200.000000px'); - console.info('testEllipse02 END'); - done(); - }); - - it('testEllipse02', 0, async function (done) { - console.info('[testEllipse02] START'); - try { - var eventData = { - data: { - "width": '100px' - } - } - var innerEvent = { - eventId: 5, - priority: events_emitter.EventPriority.LOW - } - console.info("[testEllipse02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testEllipse02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('ellipse'); - let obj = JSON.parse(strJson); - console.info("[testEllipse02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual('100.000000px'); - console.info('testEllipse02 END'); - done(); - }); - - it('testEllipse03', 0, async function (done) { - console.info('[testEllipse03] START'); - try { - var eventData = { - data: { - "height": '500px' - } - } - var innerEvent = { - eventId: 5, - priority: events_emitter.EventPriority.LOW - } - console.info("[testEllipse03] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testEllipse03] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('ellipse'); - let obj = JSON.parse(strJson); - console.info("[testEllipse03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.height).assertEqual('500.000000px'); - console.info('testEllipse03 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function ellipseJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("ellipse beforeEach start"); + let options = { + uri: 'pages/ellipse', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get ellipse state pages:" + JSON.stringify(pages)); + if (!("ellipse" == pages.name)) { + console.info("get ellipse state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push ellipse page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push ellipse page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ellipse after each called"); + }); + + it('testEllipse01', 0, async function (done) { + console.info('[testEllipse01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('ellipse'); + let obj = JSON.parse(strJson); + console.info("[testEllipse02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.height).assertEqual('200.00px'); + expect(obj.$attrs.width).assertEqual('200.00px'); + console.info('testEllipse02 END'); + done(); + }); + + it('testEllipse02', 0, async function (done) { + console.info('[testEllipse02] START'); + try { + var eventData = { + data: { + "width": '100px' + } + } + var innerEvent = { + eventId: 92, + priority: events_emitter.EventPriority.LOW + } + console.info("[testEllipse02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testEllipse02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('ellipse'); + let obj = JSON.parse(strJson); + console.info("[testEllipse02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.width).assertEqual('100.00px'); + console.info('testEllipse02 END'); + done(); + }); + + it('testEllipse03', 0, async function (done) { + console.info('[testEllipse03] START'); + try { + var eventData = { + data: { + "height": '500px' + } + } + var innerEvent = { + eventId: 92, + priority: events_emitter.EventPriority.LOW + } + console.info("[testEllipse03] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testEllipse03] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('ellipse'); + let obj = JSON.parse(strJson); + console.info("[testEllipse03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.height).assertEqual('500.00px'); + console.info('testEllipse03 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets index 7a4703ff2fc59f1543bbbc460024c6ab85469f02..6e8fda4acefca97f877bbd67f8dabf7a6b067d19 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets @@ -1,87 +1,87 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; - -export default function enableJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("enable beforeEach start"); - let options = { - uri: 'pages/enable', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get enable state pages: " + JSON.stringify(pages)); - if (!("enable" == pages.name)) { - console.info("get enable state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push enable page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push enable page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("enable after each called"); - }); - - it('testEnable01', 0, async function (done) { - console.info('[testEnable01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('enabled'); - let obj = JSON.parse(strJson); - console.info("[testEnable01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.enabled).assertEqual(true); - console.info('[testEnable01] END'); - done(); - }); - - it('testEnable02', 0, async function (done) { - console.info('[testEnable02] START'); - try { - var eventData = { - data: { - "enabled": false, - "text": "disable" - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("[testEnable02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testEnable02] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('enabled'); - let obj = JSON.parse(strJson); - console.info("[testEnable02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.enabled).assertEqual(false); - console.info('testEnable02 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function enableJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("enable beforeEach start"); + let options = { + uri: 'pages/enable', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get enable state pages: " + JSON.stringify(pages)); + if (!("enable" == pages.name)) { + console.info("get enable state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push enable page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push enable page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("enable after each called"); + }); + + it('testEnable01', 0, async function (done) { + console.info('[testEnable01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('enabled'); + let obj = JSON.parse(strJson); + console.info("[testEnable01] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.enabled).assertEqual(true); + console.info('[testEnable01] END'); + done(); + }); + + it('testEnable02', 0, async function (done) { + console.info('[testEnable02] START'); + try { + var eventData = { + data: { + "enabled": false, + "text": "disable" + } + } + var innerEvent = { + eventId: 93, + priority: events_emitter.EventPriority.LOW + } + console.info("[testEnable02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testEnable02] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('enabled'); + let obj = JSON.parse(strJson); + console.info("[testEnable02] obj is: " + JSON.stringify(obj.$attrs.enabled)); + expect(obj.$attrs.enabled).assertEqual(false); + console.info('testEnable02 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexJsunit.test.ets index 986491038e2ce2844bd956db5784bb46d43c2e47..2df24e90e6d1d72d89438f895bf6d80882ad3166 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexJsunit.test.ets @@ -1,119 +1,119 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; -import router from '@system.router'; - -export default function flexJsunit() { - describe('flexTest', function () { - beforeEach(async function (done) { - console.info("flex beforeEach start"); - let options = { - uri: 'pages/general-properties/flex', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get flex state success " + JSON.stringify(pages)); - if (!("flex" == pages.name)) { - console.info("get flex state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push flex page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push flex page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("flex after each called"); - }); - - it('testFlex_0100', 0, async function (done) { - console.info("testFlex_0100 START"); - await Utils.sleep(1000); - let strJson = getInspectorByKey('flexBasis'); - console.info("testFlex_0100 component strJson:" + strJson); - let obj = JSON.parse(strJson); - await Utils.sleep(2000); - console.info("testFlex_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.flexBasis).assertEqual("auto"); - console.info('testFlex_0100 END'); - done(); - }); - - it('testFlex_0200', 0, async function (done) { - console.info('testFlex_0200 START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('flexGrow'); - console.info("testFlex_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("testFlex_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.flexGrow).assertEqual(0); - console.info('testFlex_0200 END'); - done(); - }); - - it('testFlex_0300', 0, async function (done) { - console.info('testFlex_0300 START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('flexShrink'); - console.info("testFlex_0300 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("testFlex_0300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.flexShrink).assertEqual(0); - console.info('testFlex_0300 END'); - done(); - }); - - it('testFlex_0400', 0, async function (done) { - console.info('testFlex_0400 START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('alignSelf'); - console.info("testFlex_0400 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("testFlex_0400 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Auto"); - console.info('testFlex_0400 END'); - done(); - }); - - it('testFlex_0500', 0, async function (done) { - console.info('testFlex_0500 START'); - let strJson = getInspectorByKey('flex'); - console.info("testFlex_0500 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("testFlex_0500 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Flex'); - done(); - }); - - it('testFlex_0600', 0, async function (done) { - console.info('testFlex_0600 START'); - let strJson = getInspectorByKey('flex'); - console.info("testFlex_0600 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("testFlex_0600 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); - console.info('testFlex_0600 END'); - done(); - }); - }) +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@ohos.events.emitter'; +import Utils from './Utils.ets'; +import router from '@system.router'; + +export default function flexJsunit() { + describe('flexTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/flex', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get flex state success " + JSON.stringify(pages)); + if (!("flex" == pages.name)) { + console.info("get flex state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push flex page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push flex page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("flex after each called"); + }); + + it('testFlex_0100', 0, async function (done) { + console.info("testFlex_0100 START"); + await Utils.sleep(1000); + let strJson = getInspectorByKey('flexBasis'); + console.info("testFlex_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + await Utils.sleep(2000); + console.info("testFlex_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.flexBasis).assertEqual("auto"); + console.info('testFlex_0100 END'); + done(); + }); + + it('testFlex_0200', 0, async function (done) { + console.info('testFlex_0200 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('flexGrow'); + console.info("testFlex_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testFlex_0200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.flexGrow).assertEqual(0); + console.info('testFlex_0200 END'); + done(); + }); + + it('testFlex_0300', 0, async function (done) { + console.info('testFlex_0300 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('flexShrink'); + console.info("testFlex_0300 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testFlex_0300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.flexShrink).assertEqual(0); + console.info('testFlex_0300 END'); + done(); + }); + + it('testFlex_0400', 0, async function (done) { + console.info('testFlex_0400 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('alignSelf'); + console.info("testFlex_0400 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testFlex_0400 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Auto"); + console.info('testFlex_0400 END'); + done(); + }); + + it('testFlex_0500', 0, async function (done) { + console.info('testFlex_0500 START'); + let strJson = getInspectorByKey('flex'); + console.info("testFlex_0500 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testFlex_0500 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Flex'); + done(); + }); + + it('testFlex_0600', 0, async function (done) { + console.info('testFlex_0600 START'); + let strJson = getInspectorByKey('flex'); + console.info("testFlex_0600 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testFlex_0600 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row'); + console.info('testFlex_0600 END'); + done(); + }); + }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets index 61c598b94ff53e43ff539a29822bf22a43eb4850..03cb3599501d0eb84ba115bd21eaece10b733918 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets @@ -1,187 +1,187 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function gaugeJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/gauge', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get gauge state success " + JSON.stringify(pages)); - if (!("gauge" == pages.name)) { - console.info("get gauge state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push gauge page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push gauge page error " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(2000); - console.info("gauge after each called"); - }); - - it('testGauge001', 0, async function (done) { - console.info('[testGauge001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('gauge'); - let obj = JSON.parse(strJson); - console.info("[testGauge001] component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Gauge'); - expect(obj.$attrs.strokeWidth).assertEqual('20.00vp'); - expect(obj.$attrs.width).assertEqual('200.00vp'); - expect(obj.$attrs.height).assertEqual('200.00vp'); - expect(obj.$attrs.value).assertEqual('50.00'); - done(); - }); - - it('testGauge002', 0, async function (done) { - console.info('[testGauge002] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "gaugeValue": "10" - } - } - var innerEvent = { - eventId: 1, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGauge002] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGauge002] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('gauge'); - let objNew = JSON.parse(strJsonNew); - console.info("[testGauge002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.gauge).assertEqual('10.00'); - done(); - }); - - it('testGauge003', 0, async function (done) { - console.info('[testGauge003] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "strokeWidthValue": "30", - } - } - var innerEvent = { - eventId: 1, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGauge003] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGauge003] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('gauge'); - let objNew = JSON.parse(strJsonNew); - console.info("[testGauge003] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.strokeWidth).assertEqual('30.00vp'); - done(); - }); - - it('testGauge004', 0, async function (done) { - console.info('[testGauge004] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "startAngleValue": "200" - } - } - var innerEvent = { - eventId: 1, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGauge004] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGauge004] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('gauge'); - let objNew = JSON.parse(strJsonNew); - console.info("[testGauge004] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.startAngle).assertEqual('200.00'); - done(); - }); - - it('testGauge005', 0, async function (done) { - console.info('[testGauge005] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "endAngleValue": "200" - } - } - var innerEvent = { - eventId: 1, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGauge005] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGauge005] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('gauge'); - let objNew = JSON.parse(strJsonNew); - console.info("[testGauge005] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.endAngle).assertEqual('200.00'); - done(); - }); - - it('testGauge006', 0, async function (done) { - console.info('[testGauge006] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "colorValues": JSON.stringify([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1]]) - } - } - var innerEvent = { - eventId: 2, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGauge006] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGauge006] change component data error: " + err.message); - } - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function gaugeJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/gauge', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gauge state success " + JSON.stringify(pages)); + if (!("gauge" == pages.name)) { + console.info("get gauge state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gauge page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gauge page error " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("gauge after each called"); + }); + + it('testGauge001', 0, async function (done) { + console.info('[testGauge001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('gauge'); + let obj = JSON.parse(strJson); + console.info("[testGauge001] component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.strokeWidth).assertEqual('20.00vp'); + expect(obj.$attrs.width).assertEqual('200.00vp'); + expect(obj.$attrs.height).assertEqual('200.00vp'); + expect(obj.$attrs.value).assertEqual('50.00'); + done(); + }); + + it('testGauge002', 0, async function (done) { + console.info('[testGauge002] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "gaugeValue": "10" + } + } + var innerEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGauge002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGauge002] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('gauge'); + let objNew = JSON.parse(strJsonNew); + console.info("[testGauge002] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.value).assertEqual('10.00'); + done(); + }); + + it('testGauge003', 0, async function (done) { + console.info('[testGauge003] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeWidthValue": "30", + } + } + var innerEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGauge003] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGauge003] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('gauge'); + let objNew = JSON.parse(strJsonNew); + console.info("[testGauge003] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.strokeWidth).assertEqual('30.00vp'); + done(); + }); + + it('testGauge004', 0, async function (done) { + console.info('[testGauge004] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "startAngleValue": "200" + } + } + var innerEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGauge004] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGauge004] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('gauge'); + let objNew = JSON.parse(strJsonNew); + console.info("[testGauge004] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.startAngle).assertEqual('200.00'); + done(); + }); + + it('testGauge005', 0, async function (done) { + console.info('[testGauge005] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "endAngleValue": "200" + } + } + var innerEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGauge005] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGauge005] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('gauge'); + let objNew = JSON.parse(strJsonNew); + console.info("[testGauge005] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.endAngle).assertEqual('200.00'); + done(); + }); + + it('testGauge006', 0, async function (done) { + console.info('[testGauge006] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "colorValues": JSON.stringify([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1]]) + } + } + var innerEvent = { + eventId: 103, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGauge006] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGauge006] change component data error: " + err.message); + } + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GlobalJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GlobalJsunit.test.ets index 72eec4322edfa2d0a9fe3ec016415aa1cbf8c7ef..a8f05159ca11afca0377401467a61f18e945b146 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GlobalJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GlobalJsunit.test.ets @@ -13,12 +13,98 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index.ets'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; +export default function globalJsunit() { + describe('globalJsunit', function () { + beforeEach(async function (done) { + console.info("global beforeEach start"); + let options = { + uri: 'pages/global', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get global state pages:" + JSON.stringify(pages)); + if (!("global" == pages.name)) { + console.info("get global state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push global page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push global page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + }); + + /** + * @tc.number ACE_global_setTimeout + * @tc.name setTimeout() + * @tc.desc Test setTimeout + */ + it('ACE_global_setTimeout', 0, function (done) { + let caseName:string = "ACE_global_setTimeout" + console.info(`${caseName} START`); + setTimeout(() => { + expect(true).assertTrue(); + }, 100) + console.info(`${caseName} END`); + done(); + }); + + /** + * @tc.number ACE_global_canIUse + * @tc.name canIUse() + * @tc.desc Test canIUse + */ + it('ACE_global_canIUse', 0, function (done) { + let caseName:string = "ACE_global_canIUse" + console.info(`${caseName} START`); + let syscapName:string = ""; + var result = canIUse(syscapName); + expect(result === false).assertTrue(); + console.info(`${caseName} END`); + done(); + }); + + /** + * @tc.number ACE_global_getApp + * @tc.name getApp() + * @tc.desc Test getApp + */ + it('ACE_global_getApp', 0, function (done) { + let caseName:string = "ACE_global_getApp" + console.info(`${caseName} START`); + try{ + var info = getApp(); + }catch(err){} + console.info(`${caseName} END`); + done(); + }); + + /** + * @tc.number ACE_global_createLocalParticleAbility + * @tc.name createLocalParticleAbility() + * @tc.desc Test createLocalParticleAbility + */ + it('ACE_global_createLocalParticleAbility', 0, function (done) { + let caseName:string = "ACE_global_createLocalParticleAbility" + console.info(`${caseName} START`); + try{ + var info = createLocalParticleAbility(100); + }catch(err){} + console.info(`${caseName} END`); + done(); + }); -export default function globalJsunit() { - describe("globalJsunit", function () { /** * @tc.number ACE_global_console_log_0100 * @tc.name console::log @@ -65,7 +151,7 @@ export default function globalJsunit() { * @tc.desc Test console warn printing */ it("ACE_global_console_warn_0100", 0, async function (done) { - var casename = "ACE_global_001"; + var casename = "ACE_global_003"; console.log("-----------------------ACE_global_console_warn Test is starting-----------------------"); try { console.warn("ACE_global_console_warn test ok"); @@ -78,7 +164,8 @@ export default function globalJsunit() { console.log("-----------------------ACE_global_console_warn Test end-----------------------"); done(); }); - }) -}; + + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets index d947353eae68253da34209b3a7c1602f6ad3b6c5..ec9448775728240b1b5c00d7ffba0b96030a3545 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets @@ -1,91 +1,91 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function girdContainerJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("girdContainer beforeEach start"); - let options = { - uri: 'pages/gridContainer', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get girdContainer state pages:" + JSON.stringify(pages)); - if (!("gridContainer" == pages.name)) { - console.info("get girdContainer state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push girdContainer page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push girdContainer page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("girdContainer after each called"); - }); - - it('testGirdContainer01', 0, async function (done) { - console.info('[testGirdContainer01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('gridContainer'); - let obj = JSON.parse(strJson); - console.info("[testGirdContainer01] obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('GridContainer'); - expect(obj.$attrs.constructor.columns).assertEqual('12'); - expect(obj.$attrs.constructor.sizeType).assertEqual('SizeType.XS'); - expect(obj.$attrs.constructor.gutter).assertEqual('10.000000vp'); - expect(obj.$attrs.constructor.margin).assertEqual('20.000000vp'); - console.info('testGirdContainer01 END'); - done(); - }); - - - it('testGirdContainer02', 0, async function (done) { - console.info('[testEllipse02] START'); - try { - var eventData = { - data: { - "sizeType": 'SM' - } - } - var innerEvent = { - eventId: 7, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGirdContainer02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testGirdContainer02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('gridContainer'); - let obj = JSON.parse(strJson); - console.info("[testGirdContainer02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.constructor.sizeType).assertEqual('SizeType.SM'); - console.info('testGirdContainer02 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function girdContainerJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("girdContainer beforeEach start"); + let options = { + uri: 'pages/gridContainer', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get girdContainer state pages:" + JSON.stringify(pages)); + if (!("gridContainer" == pages.name)) { + console.info("get girdContainer state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push girdContainer page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push girdContainer page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("girdContainer after each called"); + }); + + it('testGirdContainer01', 0, async function (done) { + console.info('[testGirdContainer01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('gridContainer'); + let obj = JSON.parse(strJson); + console.info("[testGirdContainer01] obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('GridContainer'); + expect(obj.$attrs.constructor.columns).assertEqual('12'); + expect(obj.$attrs.constructor.sizeType).assertEqual('SizeType.XS'); + expect(obj.$attrs.constructor.gutter).assertEqual('10.00vp'); + expect(obj.$attrs.constructor.margin).assertEqual('20.00vp'); + console.info('testGirdContainer01 END'); + done(); + }); + + + it('testGirdContainer02', 0, async function (done) { + console.info('[testEllipse02] START'); + try { + var eventData = { + data: { + "sizeType": 'SM' + } + } + var innerEvent = { + eventId: 109, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGirdContainer02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testGirdContainer02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('gridContainer'); + let obj = JSON.parse(strJson); + console.info("[testGirdContainer02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.constructor.sizeType).assertEqual('SizeType.SM'); + console.info('testGirdContainer02 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/GridSettingsJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridSettingsJsunit.test.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/GridSettingsJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridSettingsJsunit.test.ets index 3e18a457e8c7ae3f313ecbcb40c297c00ac43cde..314be977f20e3edebb9f1bff3f863a1a6c48c3c3 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/GridSettingsJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridSettingsJsunit.test.ets @@ -1,162 +1,168 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function gridSettingsJsunit() { - describe('gridSettingsTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/general-properties/gridSettings', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get gridSettings state pages:" + JSON.stringify(pages)); - if (!("textStyle" == pages.name)) { - console.info("get gridSettings state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push gridSettings page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push gridSettings page error:" + err); - } - done(); - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("gridSettings after each called"); - }); - - it('testGridSettings001', 0, async function (done) { - console.info('[testGridSettings001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('gridRow'); - console.info("[testGridSettings001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings001] gridRow useSizeType: " + JSON.stringify(obj.$attrs.useSizeType)); - expect(obj.$attrs.useSizeType.sm.span).assertEqual(2); - expect(obj.$attrs.useSizeType.sm.offset).assertEqual(1); - done(); - }); - - it('testGridSettings002', 0, async function (done) { - console.info('[testGridSettings002] START'); - try { - let eventData = { - data: { - "span": 1, - "offset": 2 - } - } - let indexEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGridSettings002] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testGridSettings002] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('gridRow'); - console.info("[testGridSettings002] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings002] gridRow useSizeType: " + JSON.stringify(obj.$attrs.useSizeType)); - expect(obj.$attrs.useSizeType.sm.span).assertEqual(1); - expect(obj.$attrs.useSizeType.sm.offset).assertEqual(2); - done(); - }); - - it('testGridSettings003', 0, async function (done) { - console.info('[testGridSettings003] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('gridOffset'); - console.info("[testGridSettings003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings003] gridOffset: " + JSON.stringify(obj.$attrs.gridOffset)); - expect(obj.$attrs.gridOffset).assertEqual(0); - done(); - }); - - it('testGridSettings004', 0, async function (done) { - console.info('[testGridSettings004] START'); - try { - let eventData = { - data: { - "gridOffset": 1 - } - } - let indexEvent = { - eventId: 46, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGridSettings004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testGridSettings004] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('gridOffset'); - console.info("[testGridSettings004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings004] gridOffset: " + JSON.stringify(obj.$attrs.gridOffset)); - expect(obj.$attrs.gridOffset).assertEqual(1); - done(); - }); - - it('testGridSettings005', 0, async function (done) { - console.info('[testGridSettings005] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('gridSpan'); - console.info("[testGridSettings005] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings005] gridSpan: " + JSON.stringify(obj.$attrs.gridSpan)); - expect(obj.$attrs.gridSpan).assertEqual(1); - done(); - }); - - it('testGridSettings006', 0, async function (done) { - console.info('[testGridSettings006] START'); - try { - let eventData = { - data: { - "gridSpan": 2 - } - } - let indexEvent = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - console.info("[testGridSettings006] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testGridSettings006] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('gridSpan'); - console.info("[testGridSettings006] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testGridSettings006] gridSpan: " + JSON.stringify(obj.$attrs.gridSpan)); - expect(obj.$attrs.gridSpan).assertEqual(2); - done(); - }); - }); +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function gridSettingsJsunit() { + describe('gridSettingsTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/gridSettings', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridSettings state pages:" + JSON.stringify(pages)); + if (!("gridSettings" == pages.name)) { + console.info("get gridSettings state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridSettings page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridSettings page error:" + err); + } + done(); + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridSettings after each called"); + }); + + it('testGridSettings001', 0, async function (done) { + console.info('[testGridSettings001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('gridRow'); + console.info("[testGridSettings001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings001] gridRow useSizeType: " + JSON.stringify(obj.$attrs.useSizeType)); + expect(obj.$attrs.useSizeType.sm.span).assertEqual(2); + expect(obj.$attrs.useSizeType.sm.offset).assertEqual(1); + console.info('[testGridSettings001] END'); + done(); + }); + + it('testGridSettings002', 0, async function (done) { + console.info('[testGridSettings002] START'); + try { + let eventData = { + data: { + "span": 1, + "offset": 2 + } + } + let indexEvent = { + eventId: 9, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGridSettings002] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testGridSettings002] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('gridRow'); + console.info("[testGridSettings002] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings002] gridRow useSizeType: " + JSON.stringify(obj.$attrs.useSizeType)); + expect(obj.$attrs.useSizeType.sm.span).assertEqual(1); + expect(obj.$attrs.useSizeType.sm.offset).assertEqual(2); + console.info('[testGridSettings002] END'); + done(); + }); + + it('testGridSettings003', 0, async function (done) { + console.info('[testGridSettings003] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('gridOffset'); + console.info("[testGridSettings003] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings003] gridOffset: " + JSON.stringify(obj.$attrs.gridOffset)); + expect(obj.$attrs.gridOffset).assertEqual(0); + console.info('[testGridSettings003] END'); + done(); + }); + + it('testGridSettings004', 0, async function (done) { + console.info('[testGridSettings004] START'); + try { + let eventData = { + data: { + "gridOffset": 1 + } + } + let indexEvent = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGridSettings004] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testGridSettings004] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('gridOffset'); + console.info("[testGridSettings004] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings004] gridOffset: " + JSON.stringify(obj.$attrs.gridOffset)); + expect(obj.$attrs.gridOffset).assertEqual(1); + console.info('[testGridSettings004] END'); + done(); + }); + + it('testGridSettings005', 0, async function (done) { + console.info('[testGridSettings005] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('gridSpan'); + console.info("[testGridSettings005] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings005] gridSpan: " + JSON.stringify(obj.$attrs.gridSpan)); + expect(obj.$attrs.gridSpan).assertEqual(1); + console.info('[testGridSettings005] END'); + done(); + }); + + it('testGridSettings006', 0, async function (done) { + console.info('[testGridSettings006] START'); + try { + let eventData = { + data: { + "gridSpan": 2 + } + } + let indexEvent = { + eventId: 11, + priority: events_emitter.EventPriority.LOW + } + console.info("[testGridSettings006] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testGridSettings006] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('gridSpan'); + console.info("[testGridSettings006] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testGridSettings006] gridSpan: " + JSON.stringify(obj.$attrs.gridSpan)); + expect(obj.$attrs.gridSpan).assertEqual(2); + console.info('[testGridSettings006] END'); + done(); + }); + }); } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ImageEffectsJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageEffectsJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ImageEffectsJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageEffectsJsunit.test.ets index 7120fbf1d640cdff920ac175e46b196360f6fdd5..db3a1522c61b2773683c68af96cc81a3ba8d197a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ImageEffectsJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageEffectsJsunit.test.ets @@ -1,323 +1,322 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils'; - -export default function imageEffectsJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/general-properties/imageEffects', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get imageEffects state success " + JSON.stringify(pages)); - if (!("imageEffects" == pages.name)) { - console.info("get imageEffects state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push imageEffects page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push imageEffects page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(2000); - console.info("imageEffects after each called"); - }); - - it('testImageEffects001', 0, async function (done) { - console.info('[testSizeSetting001] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow'); - console.info("[testImageEffects001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.blur).assertEqual(100); - done(); - }); - - it('testImageEffects002', 0, async function (done) { - console.info('[testImageEffects002] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "blurValue": "10" - } - } - var innerEvent = { - eventId: 40, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects002] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects002] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.blur).assertEqual(10); - done(); - }); - - it('testImageEffects003', 0, async function (done) { - console.info('[testImageEffects003] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow3'); - let obj = JSON.parse(strJson); - console.info("[testImageEffects003] component strJson:" + obj.$attrs.shadow); - expect(obj.$attrs.shadow.radius).assertEqual("10.000000"); - expect(obj.$attrs.shadow.color).assertEqual("#FF808080"); - expect(obj.$attrs.shadow.offsetX).assertEqual("5.000000"); - expect(obj.$attrs.shadow.offsetY).assertEqual("5.000000"); - done(); - }); - - it('testImageEffects004', 0, async function (done) { - console.info('[testImageEffects004] START'); - await Utils.sleep(1000); - let shadowValue = { radius: 20, color: Color.Gray, offsetX: 10, offsetY: 10 }; - try { - var eventData = { - data: { - "shadowValue": JSON.stringify(shadowValue) - } - } - var innerEvent = { - eventId: 41, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects004] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects004] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow3'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects004] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.shadow.radius).assertEqual("20.000000"); - expect(objNew.$attrs.shadow.color).assertEqual("4289014314"); - expect(objNew.$attrs.shadow.offsetX).assertEqual("10.000000"); - expect(objNew.$attrs.shadow.offsetY).assertEqual("10.000000"); - done(); - }); - - it('testImageEffects007', 0, async function (done) { - console.info('[testSizeSetting007] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow5'); - console.info("[testImageEffects007] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.brightness).assertEqual(20); - done(); - }); - - it('testImageEffects008', 0, async function (done) { - console.info('[testImageEffects002] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "brightnessValue": "15" - } - } - var innerEvent = { - eventId: 43, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects008] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects008] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow5'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects008] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.brightness).assertEqual(15); - done(); - }); - - it('testImageEffects009', 0, async function (done) { - console.info('[testImageEffects009] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow6'); - console.info("[testImageEffects009] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testImageEffects009] component strJson:" + obj.$attrs.saturate); - expect(obj.$attrs.saturate).assertEqual(50); - done(); - }); - - it('testImageEffects010', 0, async function (done) { - console.info('[testImageEffects010] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "saturateValue": "40" - } - } - var innerEvent = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects010] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects010] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow6'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects010] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.saturate).assertEqual(40); - done(); - }); - - it('testImageEffects011', 0, async function (done) { - console.info('[testSizeSetting011] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow7'); - console.info("[testImageEffects011] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.contrast).assertEqual(20); - done(); - }); - - it('testImageEffects012', 0, async function (done) { - console.info('[testImageEffects012] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "contrastValue": "10" - } - } - var innerEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects012] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects012] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow7'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects012] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.contrast).assertEqual(10); - done(); - }); - - it('testImageEffects013', 0, async function (done) { - console.info('[testSizeSetting0013] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow8'); - console.info("[testImageEffects013] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.invert).assertEqual(10); - done(); - }); - - it('testImageEffects014', 0, async function (done) { - console.info('[testImageEffects014] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "invertValue": "20" - } - } - var innerEvent = { - eventId: 46, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects014] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects014] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow8'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects014] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.invert).assertEqual(20); - done(); - }); - - it('testImageEffects015', 0, async function (done) { - console.info('[testImageEffects015] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('centerRow9'); - console.info("[testImageEffects015] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testImageEffects015] component strJson:" + obj.$attrs.shadow); - expect(obj.$attrs.hueRotate).assertEqual(10); - done(); - }); - - it('testImageEffects016', 0, async function (done) { - console.info('[testImageEffects016] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "hueRotateValue": "20" - } - } - var innerEvent = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - console.info("[testImageEffects016] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testImageEffects016] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('centerRow9'); - let objNew = JSON.parse(strJsonNew); - console.info("[testImageEffects016] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.hueRotate).assertEqual(20); - done(); - }); - - }) -} - - - - - - - - - - - - +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function imageEffectsJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/imageEffects', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get imageEffects state success " + JSON.stringify(pages)); + if (!("imageEffects" == pages.name)) { + console.info("get imageEffects state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push imageEffects page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push imageEffects page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("imageEffects after each called"); + }); + + it('testImageEffects001', 0, async function (done) { + console.info('[testSizeSetting001] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow'); + console.info("[testImageEffects001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.blur).assertEqual(100); + done(); + }); + + it('testImageEffects002', 0, async function (done) { + console.info('[testImageEffects002] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "blurValue": "10" + } + } + var innerEvent = { + eventId: 12, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects002] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects002] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.blur).assertEqual(10); + done(); + }); + + it('testImageEffects003', 0, async function (done) { + console.info('[testImageEffects003] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow3'); + let obj = JSON.parse(strJson); + console.info("[testImageEffects003] component strJson:" + obj.$attrs.shadow); + expect(obj.$attrs.shadow.radius).assertEqual("10.000000"); + expect(obj.$attrs.shadow.color).assertEqual("#FF808080"); + expect(obj.$attrs.shadow.offsetX).assertEqual("5.000000"); + expect(obj.$attrs.shadow.offsetY).assertEqual("5.000000"); + done(); + }); + + it('testImageEffects004', 0, async function (done) { + console.info('[testImageEffects004] START'); + await Utils.sleep(1000); + let shadowValue = { radius: 20, color: Color.Gray, offsetX: 10, offsetY: 10 }; + try { + var eventData = { + data: { + "shadowValue": JSON.stringify(shadowValue) + } + } + var innerEvent = { + eventId: 13, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects004] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects004] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow3'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects004] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.shadow.radius).assertEqual("20.000000"); + expect(objNew.$attrs.shadow.color).assertEqual("#FF808080"); + expect(objNew.$attrs.shadow.offsetX).assertEqual("10.000000"); + expect(objNew.$attrs.shadow.offsetY).assertEqual("10.000000"); + done(); + }); + + it('testImageEffects007', 0, async function (done) { + console.info('[testSizeSetting007] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow5'); + console.info("[testImageEffects007] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.brightness).assertEqual(20); + done(); + }); + + it('testImageEffects008', 0, async function (done) { + console.info('[testImageEffects002] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "brightnessValue": "15" + } + } + var innerEvent = { + eventId: 15, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects008] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects008] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow5'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects008] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.brightness).assertEqual(15); + done(); + }); + + it('testImageEffects009', 0, async function (done) { + console.info('[testImageEffects009] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow6'); + console.info("[testImageEffects009] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testImageEffects009] component strJson:" + obj.$attrs.saturate); + expect(obj.$attrs.saturate).assertEqual(50); + done(); + }); + + it('testImageEffects010', 0, async function (done) { + console.info('[testImageEffects010] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "saturateValue": "40" + } + } + var innerEvent = { + eventId: 16, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects010] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects010] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow6'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects010] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.saturate).assertEqual(40); + done(); + }); + + it('testImageEffects011', 0, async function (done) { + console.info('[testSizeSetting011] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow7'); + console.info("[testImageEffects011] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.contrast).assertEqual(20); + done(); + }); + + it('testImageEffects012', 0, async function (done) { + console.info('[testImageEffects012] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "contrastValue": "10" + } + } + var innerEvent = { + eventId: 17, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects012] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects012] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow7'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects012] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.contrast).assertEqual(10); + done(); + }); + + it('testImageEffects013', 0, async function (done) { + console.info('[testSizeSetting0013] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow8'); + console.info("[testImageEffects013] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.invert).assertEqual(10); + done(); + }); + + it('testImageEffects014', 0, async function (done) { + console.info('[testImageEffects014] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "invertValue": "20" + } + } + var innerEvent = { + eventId: 18, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects014] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects014] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow8'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects014] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.invert).assertEqual(20); + done(); + }); + + it('testImageEffects015', 0, async function (done) { + console.info('[testImageEffects015] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('centerRow9'); + console.info("[testImageEffects015] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testImageEffects015] component strJson:" + obj.$attrs.shadow); + expect(obj.$attrs.hueRotate).assertEqual(10); + done(); + }); + + it('testImageEffects016', 0, async function (done) { + console.info('[testImageEffects016] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "hueRotateValue": "20" + } + } + var innerEvent = { + eventId: 19, + priority: events_emitter.EventPriority.LOW + } + console.info("[testImageEffects016] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testImageEffects016] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('centerRow9'); + let objNew = JSON.parse(strJsonNew); + console.info("[testImageEffects016] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.hueRotate).assertEqual(20); + done(); + }); + }) +} + + + + + + + + + + + + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/LayoutConstraintsJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LayoutConstraintsJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/LayoutConstraintsJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LayoutConstraintsJsunit.test.ets index 8591cce9f463ba8470b02ad41706dc0b1953ff95..aa98f601808266a86edc7df916f882ad1c3ff031 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/LayoutConstraintsJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LayoutConstraintsJsunit.test.ets @@ -1,123 +1,123 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function layoutConstraintsJsunit() { - describe('layoutConstraintsTest', function () { - beforeEach(async function (done) { - console.info("layoutConstraints beforeEach start"); - let options = { - uri: 'pages/general-properties/layoutConstraints', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get layoutConstraints state pages:" + JSON.stringify(pages)); - if (!("layoutConstraints" == pages.name)) { - console.info("get layoutConstraints state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push layoutConstraints page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push layoutConstraints page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("layoutConstraints after each called"); - }); - - it('testLayoutConstraints001', 0, async function (done) { - console.info('[testLayoutConstraints001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('aspectRatio'); - console.info("[testLayoutConstraints001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testLayoutConstraints001] aspectRatio: " + obj.$attrs.aspectRatio); - expect(obj.$attrs.aspectRatio).assertEqual(1.5); - done(); - }); - - it('testLayoutConstraints002', 0, async function (done) { - console.info('[testLayoutConstraints002] START'); - try { - let eventData = { - data: { - "aspectRatio": 2 - } - } - let indexEvent = { - eventId: 26, - priority: events_emitter.EventPriority.LOW - } - console.info("[testLayoutConstraints002] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testLayoutConstraints002] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('aspectRatio'); - console.info("[testLayoutConstraints002] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testLayoutConstraints002] aspectRatio: " + obj.$attrs.aspectRatio); - expect(obj.$attrs.aspectRatio).assertEqual(2); - done(); - }); - - it('testLayoutConstraints003', 0, async function (done) { - console.info('[testLayoutConstraints003] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('displayPriority'); - console.info("[testLayoutConstraints003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testLayoutConstraints003] displayPriority: " + obj.$attrs.displayPriority); - expect(obj.$attrs.displayPriority).assertEqual(1); - done(); - }); - - it('testLayoutConstraints004', 0, async function (done) { - console.info('[testLayoutConstraints004] START'); - try { - let eventData = { - data: { - "displayPriority": 5 - } - } - let indexEvent = { - eventId: 27, - priority: events_emitter.EventPriority.LOW - } - console.info("[testLayoutConstraints004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testLayoutConstraints004] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('displayPriority'); - console.info("[testLayoutConstraints004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testLayoutConstraints004] displayPriority: " + obj.$attrs.displayPriority); - expect(obj.$attrs.displayPriority).assertEqual(5); - done(); - }); - }); +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function layoutConstraintsJsunit() { + describe('layoutConstraintsTest', function () { + beforeEach(async function (done) { + console.info("layoutConstraints beforeEach start"); + let options = { + uri: 'pages/layoutConstraints', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get layoutConstraints state pages:" + JSON.stringify(pages)); + if (!("layoutConstraints" == pages.name)) { + console.info("get layoutConstraints state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push layoutConstraints page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push layoutConstraints page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("layoutConstraints after each called"); + }); + + it('testLayoutConstraints001', 0, async function (done) { + console.info('[testLayoutConstraints001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('aspectRatio'); + console.info("[testLayoutConstraints001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testLayoutConstraints001] aspectRatio: " + obj.$attrs.aspectRatio); + expect(obj.$attrs.aspectRatio).assertEqual(1.5); + done(); + }); + + it('testLayoutConstraints002', 0, async function (done) { + console.info('[testLayoutConstraints002] START'); + try { + let eventData = { + data: { + "aspectRatio": 2 + } + } + let indexEvent = { + eventId: 20, + priority: events_emitter.EventPriority.LOW + } + console.info("[testLayoutConstraints002] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testLayoutConstraints002] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('aspectRatio'); + console.info("[testLayoutConstraints002] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testLayoutConstraints002] aspectRatio: " + obj.$attrs.aspectRatio); + expect(obj.$attrs.aspectRatio).assertEqual(2); + done(); + }); + + it('testLayoutConstraints003', 0, async function (done) { + console.info('[testLayoutConstraints003] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('displayPriority'); + console.info("[testLayoutConstraints003] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testLayoutConstraints003] displayPriority: " + obj.$attrs.displayPriority); + expect(obj.$attrs.displayPriority).assertEqual(1); + done(); + }); + + it('testLayoutConstraints004', 0, async function (done) { + console.info('[testLayoutConstraints004] START'); + try { + let eventData = { + data: { + "displayPriority": 5 + } + } + let indexEvent = { + eventId: 21, + priority: events_emitter.EventPriority.LOW + } + console.info("[testLayoutConstraints004] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testLayoutConstraints004] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('displayPriority'); + console.info("[testLayoutConstraints004] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testLayoutConstraints004] displayPriority: " + obj.$attrs.displayPriority); + expect(obj.$attrs.displayPriority).assertEqual(5); + done(); + }); + }); } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets index ead1456fae9676a89a92ab252bc721adb3a996bd..284be6bd84740912338648c93e27810e5dedb95f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets @@ -1,262 +1,60 @@ -/** - * 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 gaugeJsunit from './GaugeJsunit.test.ets'; -import ellipseJsunit from './EllipseJsunit.test.ets'; -import systemRouterJsunit from './SystemRouterJsunit.test.ets'; -import marqueeJsunit from './MarqueeJsunit.test.ets'; -import stepperJsunit from './StepperJsunit.test.ets'; -import gridContainerJsunit from './GridContainerJsunit.test.ets'; -import listJsunit from './ListJsunit.test.ets'; -import sizeSettingJsunit from './general-properties/SizeSettingJsunit.test.ets'; -import positionSettingJsunit from './general-properties/PositionSettingJsunit.test.ets'; -import opacitySettingJsunit from './general-properties/OpacitySettingJsunit.test.ets'; -import swiperJsunit from './SwiperJsunit.test.ets'; -import enableJsunit from './EnableJsunit.test.ets'; -import clickEventJsunit from './general-properties/ClickEventJsunit.test.ets'; -import colorGradientJsunit from './general-properties/ColorGradientJsunit.test.ets'; -import visibilityJsunit from './general-properties/VisibilityJsunit.test.ets'; -import layoutConstraintsJsunit from './general-properties/LayoutConstraintsJsunit.test.ets'; -import areaChangeJsunit from './AreaChangeJsunit.test.ets'; -import appearJsunit from './AppearJsunit.test.ets'; -import overlayJsunit from './OverlayJsunit.test.ets'; -import ZIndexJsunit from './ZIndexJsunit.test.ets'; -import touchAbleJsunit from './general-properties/TouchAbleJsunit.test.ets'; -import shapeClippingJsunit from './general-properties/ShapeClippingJsunit.test.ets'; -import textStyleJsunit from './general-properties/TextStyleJsunit.test.ets'; -import imageEffectsJsunit from './general-properties/ImageEffectsJsunit.test.ets'; -import transformJsunit from './general-properties/TransFormJsunit.test.ets'; -import gridSettingsJsunit from './general-properties/GridSettingsJsunit.test.ets'; -import touchJsunit from './general-properties/TouchJsunit.test.ets' -import backgroundJsunit from './general-properties/BackgroundJsunit.test.ets'; -import borderJsunit from './general-properties/BorderJsunit.test.ets'; -import flexJsunit from './general-properties/FlexJsunit.test.ets'; -import gridJsunit from './GridJsunit.test.ets'; -import canvasJsunit from './CanvasJsunit.test.ets'; -import textJsunit from './TextJsunit.test.ets'; -import badgeJsunit from './BadgeJsunit.test.ets'; -import longPressGestureJsUnit from './LongPressGesture.test.ets'; -import buttonJsunit from './ButtonJsunit.test.ets'; -import globalJsunit from './GlobalJsunit.test.ets'; -import responseRegionJsunit from './general-properties/ResponseRegionJsunit.test.ets'; -import panGestureJsunit from './general-properties/PanGestureJsunit.test.ets'; -import tabsJsunit from './TabsJsunit.test.ets'; -import qrCodeJsunit from './QrCodeJsunit.test.ets'; -import tapGesture from './TapGesture.test.ets'; -import progressJsunit from './ProgressJsunit.test.ets'; -import animateJsunit from './AnimateJsunit.test.ets'; -import commonJsunit from './CommonJsunit.test.ets'; -import spanJsunit from './SpanJsunit.test.ets'; -import columnJsunit from './ColumnJsunit.test.ets'; -import ratingJsunit from './RatingJsunit.test.ets'; -import canvas2Jsunit from './Canvas2Jsunit.test.ets'; -import toggleJsunit from './ToggleJsunit.test.ets'; -import shapeJsunit from './ShapeJsunit.test.ets'; -import motionPathJsunit from './MotionPathJsunit.test.ets'; -import scrollCodeJsunit from './ScrollCodeJsunit.test.ets'; -import transitionJsunit from './TransitionJsunit.test.ets'; -import priorityGestureJsunit from './PriorityGestureJsunit.test.ets'; -import parallelGestureJsunit from './ParallelGestureJsunit.test.ets'; -import blankJsunit from './BlankJsunit.test.ets'; -import sharedTransitionJsunit from './SharedTransitionJsunit.test.ets'; -import alphabetIndexerJsunit from './AlphabetIndexerJsunit.test.ets'; -import lineJsunit from './LineJsunit.test.ets'; -import circleJsunit from './CircleJsunit.test.ets'; -import aboutToDisappearJsunit from './AboutToDisappearJsunit.test.ets'; -import bindMenuJsunit from './BindMenuJsunit.test.ets'; -import bindPopupJsunit from './BindPopupJsunit.test.ets'; -import directionJsunit from './DirectionJsunit.test.ets'; -import timeStampJsunit from './TimeStampJsunit.test.ets'; -import listItemJsunit from './ListItemJsunit.test.ets'; -import navigatorCodeJsunit from './NavigatorCodeJsunit.test.ets'; -import pieceJsunit from './PieceJsunit.test.ets'; -import dividerJsunit from './DividerJsunit.test.ets'; -import systemAppJsunit from './SystemAppJsunit.test.ets'; -import systempromptJsunit from './SystempromptJsunit.test.ets'; -import configurationJsunit from './ConfigurationJsunit.test.ets'; -import sourceTypeJsunit from './SourceTypeJsunit.test.ets'; -import pageTransitionJsunit from './PageTransitionJsunit.test.ets'; -import navigationJsunit from './NavigationJsunit.test.ets'; -import loadingProgressJsunit from './LoadingProgressJsunit.test.ets'; -import radioJsunit from './RadioJsunit.test.ets'; -import rowJsunit from './RowJsunit.test.ets'; -import scrollBarJsunit from './ScrollBarJsunit.test.ets'; -import searchJsunit from './SearchJsunit.test.ets'; -import placementJsunit from './PlacementJsunit.test.ets'; -import imageAnimatorJsunit from './ImageAnimatorJsunit.test.ets' -import animationStatusJsunit from './AnimationStatusJsunit.test.ets'; -import curvesJsunit from './CurvesJsunit.test.ets'; -import gradientDirectionJsunit from './GradientDirectionJsunit.test.ets'; -import enmusFlexAlignJsunit from './EnmusFlexAlignJsunit.test.ets'; -import ohosRouterJsunit from './OhosRouterJsnuit.test.ets'; -import flexDirectionJsunit from './FlexDirectionJsunit.test.ets'; -import flexWrapJsunit from './FlexWrapJsunit.test.ets'; -import datePickerJsunit from './DatePickerJsunit.test.ets'; -import enmusVerticalAlignJsunit from './EnmusVerticalAlignJsunit.test.ets'; -import enmusHorizontalAlignJsunit from './EnmusHorizontalAlignJsunit.test.ets'; -import direction2Jsunit from './Direction2Jsunit.test.ets'; -import patternLockJsunit from './PatternLockJsunit.test.ets'; -import enumsImageJsunit from './EnmusImageJsunit.test.ets'; -import sliderJsunit from './sliderJsunit.test.ets' -import edgeEffectJsunit from './EdgeEffectJsunit.test.ets' -import checkboxJsunit from './CheckboxJsunit.test.ets'; -import checkboxGroupJsunit from './CheckboxGroupJsunit.test.ets'; -import customDialogControllerJsunit from './CustomDialogControllerJsunit.test.ets'; -import ohosMatrix4Jsunit from './OhosMatrix4Jsunit.test.ets'; -import ohosPromptJsunit from './OhosPromptJsunit.test.ets'; -import selectJsunit from './SelectJsunit.test.ets'; -import videoJsunit from './VideoJsunit.test.ets'; -import refreshJsunit from './RefreshJsunit.test.ets'; -import richTextJsunit from './RichTextJsunit.test.ets'; -import textPickerJsunit from './TextPickerJsunit.test.ets' -import textTimerJsunit from './TextTimerJsunit.test.ets' -import subscribedAbstractPropertyJsunit from './SubscribedAbstractPropertyJsunit.test.ets' -import contentStorageJsunit from './ContentStorage.test.ets'; -import appStorageJsunit from './AppStorageJsunit.test.ets'; -import subscribaleAbstractJsunit from './SubscribaleAbstractJsunit.test.ets'; -import pathJsunit from './PathJsunit.test.ets'; -import enumsLineCapStyleJsunit from './EnmusLineCapStyleJsunit.test.ets'; -import enmusItemAlignJsunit from './EnmusItemAlignJsunit.test.ets' -import fillModeJsunit from './FillModeJsunit.test.ets'; -import playModeJsunit from './PlayModeJsunit.test.ets'; -import SwipeDirectionJsunit from './SwipeDirectionJsunit.test.ets'; -import GestureModeJsunit from './GestureModeJsunit.test.ets'; -import PanDirectionJsunit from './PanDirectionJsunit.test.ets'; -import sideBarJsunit from './SideBarJsunit.test.ets'; - -export default function testsuite() { - gaugeJsunit(); - ellipseJsunit(); - systemRouterJsunit(); - marqueeJsunit(); - stepperJsunit(); - gridContainerJsunit(); - listJsunit(); - sizeSettingJsunit(); - positionSettingJsunit(); - opacitySettingJsunit(); - swiperJsunit(); - enableJsunit(); - clickEventJsunit(); - layoutConstraintsJsunit(); - colorGradientJsunit(); - areaChangeJsunit(); - appearJsunit(); - overlayJsunit(); - visibilityJsunit(); - globalJsunit(); - ZIndexJsunit(); - touchAbleJsunit(); - shapeClippingJsunit(); - textStyleJsunit(); - imageEffectsJsunit(); - transformJsunit(); - gridSettingsJsunit(); - touchJsunit(); - backgroundJsunit(); - borderJsunit(); - flexJsunit(); - gridJsunit(); - textJsunit(); - badgeJsunit(); - canvasJsunit(); - canvas2Jsunit(); - longPressGestureJsUnit(); - buttonJsunit(); - responseRegionJsunit(); - tabsJsunit(); - panGestureJsunit(); - qrCodeJsunit(); - tapGesture(); - progressJsunit(); - animateJsunit(); - commonJsunit(); - spanJsunit(); - ratingJsunit(); - toggleJsunit(); - shapeJsunit(); - motionPathJsunit(); - columnJsunit(); - scrollCodeJsunit(); - transitionJsunit(); - priorityGestureJsunit(); - parallelGestureJsunit(); - blankJsunit(); - sharedTransitionJsunit(); - alphabetIndexerJsunit(); - lineJsunit(); - circleJsunit(); - aboutToDisappearJsunit(); - timeStampJsunit(); - bindMenuJsunit(); - bindPopupJsunit(); - directionJsunit(); - dividerJsunit(); - systempromptJsunit(); - configurationJsunit(); - sourceTypeJsunit(); - pageTransitionJsunit(); - navigationJsunit(); - loadingProgressJsunit(); - radioJsunit(); - rowJsunit(); - listItemJsunit(); - navigatorCodeJsunit(); - pieceJsunit(); - searchJsunit(); - scrollBarJsunit(); - placementJsunit(); - imageAnimatorJsunit(); - animationStatusJsunit(); - curvesJsunit(); - gradientDirectionJsunit(); - enmusFlexAlignJsunit(); - flexDirectionJsunit(); - datePickerJsunit(); - flexWrapJsunit(); - enmusVerticalAlignJsunit(); - enmusHorizontalAlignJsunit(); - ohosRouterJsunit(); - direction2Jsunit(); - patternLockJsunit(); - enumsImageJsunit(); - sliderJsunit(); - edgeEffectJsunit(); - checkboxJsunit(); - checkboxGroupJsunit(); - customDialogControllerJsunit(); - selectJsunit(); - ohosMatrix4Jsunit(); - ohosPromptJsunit(); - videoJsunit(); - richTextJsunit(); - refreshJsunit(); - searchJsunit(); - textPickerJsunit(); - textTimerJsunit(); - subscribedAbstractPropertyJsunit(); - contentStorageJsunit(); - appStorageJsunit(); - subscribaleAbstractJsunit(); - pathJsunit(); - enumsLineCapStyleJsunit(); - enmusItemAlignJsunit(); - fillModeJsunit(); - playModeJsunit(); - SwipeDirectionJsunit(); - GestureModeJsunit(); - PanDirectionJsunit(); - sideBarJsunit(); - systemAppJsunit(); -} +/** + * 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 appearJsunit from './AppearJsunit.test.ets'; +import areaChangeJsunit from './AreaChangeJsunit.test.ets'; +import ellipseJsunit from './EllipseJsunit.test.ets'; +import enableJsunit from './EnableJsunit.test.ets'; +import flexJsunit from './FlexJsunit.test.ets'; +import gaugeJsunit from './GaugeJsunit.test.ets'; +import globalJsunit from './GlobalJsunit.test.ets'; +import girdContainerJsunit from './GridContainerJsunit.test.ets'; +import gridSettingsJsunit from './GridSettingsJsunit.test.ets'; +import imageEffectsJsunit from './ImageEffectsJsunit.test.ets'; +import layoutConstraintsJsunit from './LayoutConstraintsJsunit.test.ets'; +import listJsunit from './ListJsunit.test.ets'; +import marqueeJsunit from './MarqueeJsunit.test.ets'; +import overLayJsunit from './OverlayJsunit.test.ets'; +import stepperJsunit from './StepperJsunit.test.ets'; +import swiperJsunit from './SwiperJsunit.test.ets'; +import textStyleJsunit from './TextStyleJsunit.test.ets'; +import touchAbleJsunit from './TouchAbleJsunit.test.ets'; +import touchJsunit from './TouchJsunit.test.ets'; +import visibilityJsunit from './VisibilityJsunit.test.ets'; +import zIndexJsunit from './ZIndexJsunit.test.ets'; + +export default function testsuite() { + enableJsunit(); + appearJsunit(); + zIndexJsunit(); + ellipseJsunit(); + flexJsunit(); + gaugeJsunit(); + globalJsunit(); + visibilityJsunit(); + girdContainerJsunit(); + areaChangeJsunit(); + gridSettingsJsunit(); + imageEffectsJsunit(); + layoutConstraintsJsunit(); + listJsunit(); + marqueeJsunit(); + overLayJsunit(); + stepperJsunit(); + swiperJsunit(); + textStyleJsunit(); + touchAbleJsunit(); + touchJsunit(); +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets index 84609ff604a1839321f218eac7b7b1d5bff42fbb..7a06b68a8036dfd951586255fcbf64eb207c02a5 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets @@ -1,275 +1,275 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function listJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("list beforeEach start"); - let options = { - uri: 'pages/list', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get list state pages:" + JSON.stringify(pages)); - if (!("list" == pages.name)) { - console.info("get list state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push list page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push list page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("list after each called"); - }); - - it('testList01', 0, async function (done) { - console.info('[testList01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.listDirection).assertEqual('Axis.Vertical'); - expect(obj.$attrs.editMode).assertEqual('false'); - expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.None'); - expect(obj.$attrs.chainAnimation).assertEqual('false'); - expect(obj.$attrs.divider.strokeWidth).assertEqual("2.000000vp"); - expect(obj.$attrs.divider.color).assertEqual("#FFFFFFFF"); - expect(obj.$attrs.divider.startMargin).assertEqual("20.000000vp"); - expect(obj.$attrs.divider.endMargin).assertEqual("20.000000vp"); - console.info('[testList01] END'); - done(); - }); - - it('testList02', 0, async function (done) { - console.info('[testList02] START'); - try { - var eventData = { - data: { - "listDirection": Axis.Horizontal - } - } - var innerEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList02] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList02] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.listDirection).assertEqual('Axis.Horizontal'); - console.info('testList02 END'); - done(); - }); - - it('testList03', 0, async function (done) { - console.info('[testList03] START'); - try { - var eventData = { - data: { - "editMode": true - } - } - var innerEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList03] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList03] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.editMode).assertEqual('true'); - console.info('testList03 END'); - done(); - }); - - it('testList04', 0, async function (done) { - console.info('[testList04] START'); - try { - var eventData = { - data: { - "edgeEffect": EdgeEffect.Spring - } - } - var innerEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList04] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList04] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.Spring'); - console.info('testList04 END'); - done(); - }); - - it('testList05', 0, async function (done) { - console.info('[testList05] START'); - try { - var eventData = { - data: { - "chainAnimation": true - } - } - var innerEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList05] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList05] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList05] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.chainAnimation).assertEqual('true'); - console.info('testList05 END'); - done(); - }); - - it('testList06', 0, async function (done) { - console.info('[testList06] START'); - try { - var eventData = { - data: { - "strokeWidth": "3.000000vp" - } - } - var innerEvent = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList06] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList06] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList06] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.divider.strokeWidth).assertEqual("3.000000vp"); - console.info('testList06 END'); - done(); - }); - - it('testList07', 0, async function (done) { - console.info('[testList07] START'); - try { - var eventData = { - data: { - "color": "#FF0000FF" - } - } - var innerEvent = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList07] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList07] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList07] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.divider.color).assertEqual("#FF0000FF"); - console.info('testList07 END'); - done(); - }); - - it('testList08', 0, async function (done) { - console.info('[testList08] START'); - try { - var eventData = { - data: { - "startMargin": "30.000000vp" - } - } - var innerEvent = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList08] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList08] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList08] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.divider.startMargin).assertEqual("30.000000vp"); - console.info('testList08 END'); - done(); - }); - - it('testList09', 0, async function (done) { - console.info('[testList09] START'); - try { - var eventData = { - data: { - "endMargin": "30.000000vp" - } - } - var innerEvent = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - console.info("[testList09] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testList09] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('list'); - let obj = JSON.parse(strJson); - console.info("[testList09] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.divider.endMargin).assertEqual("30.000000vp"); - console.info('testList09 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function listJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("list beforeEach start"); + let options = { + uri: 'pages/list', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get list state pages:" + JSON.stringify(pages)); + if (!("list" == pages.name)) { + console.info("get list state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push list page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push list page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("list after each called"); + }); + + it('testList01', 0, async function (done) { + console.info('[testList01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList01] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.listDirection).assertEqual('Axis.Vertical'); + expect(obj.$attrs.editMode).assertEqual('false'); + expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.None'); + expect(obj.$attrs.chainAnimation).assertEqual('false'); + expect(obj.$attrs.divider.strokeWidth).assertEqual("2.00vp"); + expect(obj.$attrs.divider.color).assertEqual("#FFFFFFFF"); + expect(obj.$attrs.divider.startMargin).assertEqual("20.00vp"); + expect(obj.$attrs.divider.endMargin).assertEqual("20.00vp"); + console.info('[testList01] END'); + done(); + }); + + it('testList02', 0, async function (done) { + console.info('[testList02] START'); + try { + var eventData = { + data: { + "listDirection": Axis.Horizontal + } + } + var innerEvent = { + eventId: 124, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList02] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList02] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.listDirection).assertEqual('Axis.Horizontal'); + console.info('testList02 END'); + done(); + }); + + it('testList03', 0, async function (done) { + console.info('[testList03] START'); + try { + var eventData = { + data: { + "editMode": true + } + } + var innerEvent = { + eventId: 124, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList03] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList03] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.editMode).assertEqual('true'); + console.info('testList03 END'); + done(); + }); + + it('testList04', 0, async function (done) { + console.info('[testList04] START'); + try { + var eventData = { + data: { + "edgeEffect": EdgeEffect.Spring + } + } + var innerEvent = { + eventId: 124, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList04] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList04] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList04] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.Spring'); + console.info('testList04 END'); + done(); + }); + + it('testList05', 0, async function (done) { + console.info('[testList05] START'); + try { + var eventData = { + data: { + "chainAnimation": true + } + } + var innerEvent = { + eventId: 124, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList05] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList05] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList05] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.chainAnimation).assertEqual('true'); + console.info('testList05 END'); + done(); + }); + + it('testList06', 0, async function (done) { + console.info('[testList06] START'); + try { + var eventData = { + data: { + "strokeWidth": "3.000000vp" + } + } + var innerEvent = { + eventId: 125, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList06] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList06] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList06] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.divider.strokeWidth).assertEqual("3.00vp"); + console.info('testList06 END'); + done(); + }); + + it('testList07', 0, async function (done) { + console.info('[testList07] START'); + try { + var eventData = { + data: { + "color": "#FF0000FF" + } + } + var innerEvent = { + eventId: 125, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList07] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList07] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList07] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.divider.color).assertEqual("#FF0000FF"); + console.info('testList07 END'); + done(); + }); + + it('testList08', 0, async function (done) { + console.info('[testList08] START'); + try { + var eventData = { + data: { + "startMargin": "30.000000vp" + } + } + var innerEvent = { + eventId: 125, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList08] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList08] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList08] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.divider.startMargin).assertEqual("30.00vp"); + console.info('testList08 END'); + done(); + }); + + it('testList09', 0, async function (done) { + console.info('[testList09] START'); + try { + var eventData = { + data: { + "endMargin": "30.000000vp" + } + } + var innerEvent = { + eventId: 125, + priority: events_emitter.EventPriority.LOW + } + console.info("[testList09] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testList09] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('list'); + let obj = JSON.parse(strJson); + console.info("[testList09] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.divider.endMargin).assertEqual("30.00vp"); + console.info('testList09 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets deleted file mode 100755 index 748f099320e2f5f1f9fdad8e63b7b18dbee13ac3..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function loadingProgressJsunit() { - describe('loadingProgressTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/loadingProgress', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get loadingProgress state success " + JSON.stringify(pages)); - if (!("loadingProgress" == pages.name)) { - console.info("get loadingProgress state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(4000); - console.info("push loadingProgress page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push loadingProgress page error " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("loadingProgress after each called"); - }); - }) -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MarqueeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MarqueeJsunit.test.ets index f5e1da25ecf8341c5832182d6dc1ff16cb3975c3..5ea983cc34b12e92ba73fc9cad68d3c48f4d5ffb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MarqueeJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MarqueeJsunit.test.ets @@ -1,154 +1,154 @@ -/** - * 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 Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function marqueeJsunit() { - describe('marqueeTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/marquee', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get marquee state success " + JSON.stringify(pages)); - if (!("marquee" == pages.name)) { - console.info("get marquee state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(4000); - console.info("push marquee page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push marquee page error " + JSON.stringify(result)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("marquee after each called"); - }); - - - it('testMarquee_0100', 0, async function (done) { - console.info('testMarquee_0100 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("testMarquee_0100 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.start).assertEqual(true); - } - let indexEvent = { - eventId: 10, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testMarquee_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); - await Utils.sleep(1000); - var callback1 = (eventData) => { - console.info("testMarquee_0100 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.fontColor).assertEqual(Color.Blue); - } - var innerEventOne = { - eventId: 11, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEventOne, callback1); - } catch (err) { - console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err)); - } - console.info('testMarquee_0100 END'); - done(); - }); - - it('testMarquee_0200', 0, async function (done) { - console.info('testMarquee_0200 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("testMarquee_0200 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.start).assertEqual(true); - } - let indexEvent = { - eventId: 10, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testMarquee_0200 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); - await Utils.sleep(1000); - var callback1 = (eventData) => { - console.info("testMarquee_0200 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.fontSize).assertEqual(50); - } - var innerEventOne = { - eventId: 15, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEventOne, callback1) - } catch (err) { - console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err)); - } - console.info('testMarquee_0200 END'); - done(); - }); - - it('testMarquee_0300', 0, async function (done) { - console.info('testMarquee_0300 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("testMarquee_0300 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.start).assertEqual(true); - } - let indexEvent = { - eventId: 10, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testMarquee_0300 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); - await Utils.sleep(1000); - var callback1 = (eventData) => { - console.info("testMarquee_0300 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true); - } - var innerEventOne = { - eventId: 16, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEventOne, callback1) - } catch (err) { - console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err)); - } - console.info('testMarquee_0300 END'); - done(); - }); - }) +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; + +import events_emitter from '@ohos.events.emitter'; +export default function marqueeJsunit() { + describe('marqueeTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/marquee', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get marquee state success " + JSON.stringify(pages)); + if (!("marquee" == pages.name)) { + console.info("get marquee state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(4000); + console.info("push marquee page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push marquee page error " + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("marquee after each called"); + }); + + + it('testMarquee_0100', 0, async function (done) { + console.info('testMarquee_0100 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("testMarquee_0100 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.start).assertEqual(true); + } + let indexEvent = { + eventId: 130, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testMarquee_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + var callback1 = (eventData) => { + console.info("testMarquee_0100 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.fontColor).assertEqual(Color.Blue); + } + var innerEventOne = { + eventId: 127, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testMarquee_0100 END'); + done(); + }); + + it('testMarquee_0200', 0, async function (done) { + console.info('testMarquee_0200 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("testMarquee_0200 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.start).assertEqual(true); + } + let indexEvent = { + eventId: 130, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testMarquee_0200 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + var callback1 = (eventData) => { + console.info("testMarquee_0200 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.fontSize).assertEqual(50); + } + var innerEventOne = { + eventId: 128, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEventOne, callback1) + } catch (err) { + console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testMarquee_0200 END'); + done(); + }); + + it('testMarquee_0300', 0, async function (done) { + console.info('testMarquee_0300 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("testMarquee_0300 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.start).assertEqual(true); + } + let indexEvent = { + eventId: 130, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testMarquee_0300 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + var callback1 = (eventData) => { + console.info("testMarquee_0300 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true); + } + var innerEventOne = { + eventId: 129, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEventOne, callback1) + } catch (err) { + console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testMarquee_0300 END'); + done(); + }); + }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets deleted file mode 100755 index d975f481d025014ffe7dac17cdecaa1ea9946e28..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets +++ /dev/null @@ -1,106 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils.ets'; - -export default function navigatorCodeJsunit() { - beforeEach(async function (done) { - console.info("NavigatorClick beforeEach start"); - let options = { - uri: 'pages/NavigatorCode', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get NavigatorClick state pages:" + JSON.stringify(pages)); - if (!("NavigatorClick" == pages.name)) { - console.info("get NavigatorClick state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push NavigatorClick page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push NavigatorClick page error:" + JSON.stringify(result)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("NavigatorClick after each called"); - }); - - it('test_NavigatorClick_001', 0, async function (done) { - console.info('[test_NavigatorClick_001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('NavigatorClick'); - let obj = JSON.parse(strJson); - console.info("[test_NavigatorClick_001] component obj is: " + JSON.stringify(obj)); - await Utils.sleep(1000); - expect(obj.$attrs.active).assertEqual('false'); - done(); - }); - - it('test_NavigatorClick_004', 0, async function (done) { - console.info('[test_NavigatorClick_004] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "typeValue": "NavigationType.Back" - } - } - var innerEvent = { - eventId: 101, - priority: events_emitter.EventPriority.LOW - } - console.info("[test_NavigatorClick_004] start to publish emit" + JSON.stringify(eventData)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[test_NavigatorClick_004] change component error: " + err.message); - } - await Utils.sleep(2000); - var strJson = getInspectorByKey('NavigatorType'); - var obj = JSON.parse(strJson); - console.info("[test_NavigatorClick_004] component obj is: " + JSON.stringify(obj.$attrs.type)); - expect(obj.$attrs.type).assertEqual('NavigationType.Back'); - done(); - }); - - it('test_NavigatorClick_004', 0, async function (done) { - await Utils.sleep(1000) - var callback = (eventData) => { - console.info("[test_NavigatorClick_004] get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(10) - } - var innerEvent = { - eventId: 30, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEvent, callback) - } catch (err) { - console.info("[test_NavigatorClick_004] on events_emitter err : " + JSON.stringify(err)); - } - console.info('[test_NavigatorClick_004] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, ""))); - await Utils.sleep(1000) - console.info('[test_NavigatorClick_004] testSendTouchEvent END'); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets index 024e066a3c2cfde9160c4d42a3aa9c90209cb8cb..8382bbe5db921ca633c7d6f78a64b85c9e5e0088 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets @@ -1,95 +1,146 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; - -export default function enableJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("overlay beforeEach start"); - let options = { - uri: 'pages/overlay', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get overlay state pages: " + JSON.stringify(pages)); - if (!("overlay" == pages.name)) { - console.info("get overlay state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push overlay page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push overlay page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("overlay after each called"); - }); - - it('testOverlay01', 0, async function (done) { - console.info('[testOverlay01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('overlay'); - let obj = JSON.parse(strJson); - console.info("[testOverlay01] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.title).assertEqual("old title"); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.Bottom"); - expect(obj.$attrs.overlay.options.offset.x).assertEqual('0.000000vp'); - expect(obj.$attrs.overlay.options.offset.y).assertEqual('-15.000000vp'); - console.info('[testOverlay01] END'); - done(); - }); - - it('testOverlay02', 0, async function (done) { - console.info('[testOverlay02] START'); - try { - var eventData = { - data: { - "title": "new title", - "align": "Alignment.TopStart", - "x": 30, - "y": -30 - } - } - var innerEvent = { - eventId: 83, - priority: events_emitter.EventPriority.LOW - } - console.info("[testOverlay02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testOverlay02] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('overlay'); - let obj = JSON.parse(strJson); - console.info("[testOverlay02] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.title).assertEqual("new title"); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); - expect(obj.$attrs.overlay.options.offset.x).assertEqual('30.000000vp'); - expect(obj.$attrs.overlay.options.offset.y).assertEqual('-30.000000vp'); - console.info('testOverlay02 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function overLayJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("overlay beforeEach start"); + let options = { + uri: 'pages/overlay', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get overlay state pages: " + JSON.stringify(pages)); + if (!("overlay" == pages.name)) { + console.info("get overlay state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push overlay page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push overlay page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("overlay after each called"); + }); + + it('testOverlay01', 0, async function (done) { + console.info('[testOverlay01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('overlay'); + let obj = JSON.parse(strJson); + console.info("[testOverlay01] obj is: " + JSON.stringify(obj.$attrs.overlay)); + expect(obj.$attrs.overlay.title).assertEqual("old title"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.Bottom"); + expect(obj.$attrs.overlay.options.offset.x).assertEqual('0.00vp'); + expect(obj.$attrs.overlay.options.offset.y).assertEqual('-15.00vp'); + console.info('[testOverlay01] END'); + done(); + }); + + it('testOverlay02', 0, async function (done) { + console.info('[testOverlay02] START'); + try { + var eventData = { + data: { + "title": "new title" + } + } + var innerEvent = { + eventId: 143, + priority: events_emitter.EventPriority.LOW + } + console.info("[testOverlay02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testOverlay02] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('overlay'); + let obj = JSON.parse(strJson); + console.info("[testOverlay02] obj is: " + JSON.stringify(obj.$attrs.overlay)); + expect(obj.$attrs.overlay.title).assertEqual("new title"); + console.info('testOverlay02 END'); + done(); + }); + + it('testOverlay03', 0, async function (done) { + console.info('[testOverlay03] START'); + try { + var eventData = { + data: { + "align": "Alignment.TopStart", + "x": 30, + "y": -30 + } + } + var innerEvent = { + eventId: 143, + priority: events_emitter.EventPriority.LOW + } + console.info("[testOverlay03] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testOverlay03] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('overlay'); + let obj = JSON.parse(strJson); + console.info("[testOverlay03] obj is: " + JSON.stringify(obj.$attrs.overlay)); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); + expect(obj.$attrs.overlay.options.offset.x).assertEqual('30.00vp'); + expect(obj.$attrs.overlay.options.offset.y).assertEqual('-30.00vp'); + console.info('testOverlay03 END'); + done(); + }); + + it('testOverlay04', 0, async function (done) { + console.info('[testOverlay04] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "align": "Alignment.Center" + } + } + var innerEvent = { + eventId: 143, + priority: events_emitter.EventPriority.LOW + } + console.info("[testOverlay04] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testOverlay04] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('overlay'); + let obj = JSON.parse(strJson); + console.info("[testOverlay04] obj is: " + JSON.stringify(obj.$attrs.overlay)); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); + console.info('testOverlay04 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets deleted file mode 100755 index 3348e2f05b4fac0588b72498d2360e7d0c92fd0a..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets +++ /dev/null @@ -1,118 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; - -export default function patternLockJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("patternLock beforeEach start"); - let options = { - uri: 'pages/patternLock', - } - let result; - try { - router.clear(); - let pages = router.getState(); - console.info("get patternLock state pages: " + JSON.stringify(pages)); - if (!("button" == pages.name)) { - console.info("get patternLock state pages.name: " + JSON.stringify(pages.name)); - result = await router.push(options); - await Utils.sleep(2000); - console.info("push patternLock page result: " + JSON.stringify(result)); - } - } catch (err) { - console.error("push patternLock page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("patternLock after each called"); - }) - - it('testPatternLock01', 0, async function (done) { - console.info('[testPatternLock01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('PatternLock'); - let obj = JSON.parse(strJson); - console.info("[testPatternLock01] component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('PatternLock'); - expect(obj.$attrs.sideLength).assertEqual('150'); - expect(obj.$attrs.circleRadius).assertEqual('7'); - expect(obj.$attrs.pathStrokeWidth).assertEqual('17'); - expect(obj.$attrs.backgroundColor).assertEqual('#FF008000'); - expect(obj.$attrs.autoReset).assertEqual('true'); - done(); - }); - - it('testPatternLock_02', 0, async function (done) { - console.info('testPatternLock_02 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("testPatternLock_02 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 70, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testPatternLock_02 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testPatternLock_02 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); - await Utils.sleep(1000); - console.info('testPatternLock_02 END'); - done(); - }); - - it('testPatternLock_03', 0, async function (done) { - console.info('testPatternLock_03 START'); - let strJson1 = getInspectorByKey('PatternLock'); - let objLP = JSON.parse(strJson1); - console.info("testPatternLock_03 component objLP is: " + objLP.$attrs.sideLength); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "backgroundColor": '#FFFFB6C1', - } - } - var innerEvent = { - eventId: 71, - priority: events_emitter.EventPriority.LOW - } - console.info("testPatternLock_03 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("testPatternLock_03 change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('PatternLock'); - let obj = JSON.parse(strJson); - console.info("testPatternLock_03 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.backgroundColor).assertEqual("#FFFFB6C1"); - console.info('testPatternLock_03 END'); - done(); - }); - - }) -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets deleted file mode 100755 index c70f5299c76c29cb16a39f1289c5015bef613650..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets +++ /dev/null @@ -1,250 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function pieceJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/PieceCode', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get PieceCode state success " + JSON.stringify(pages)); - if (!("PieceCode" == pages.name)) { - console.info("get PieceCode pages success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push PieceCode page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push PieceCode page error " + JSON.stringify(err)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(2000); - console.info("PieceCode after each called"); - }); - - it('test_pieceCode_001', 0, async function (done) { - console.info('[test_pieceCode_001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('piece'); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('piece'); - expect(obj.$attrs.iconPosition).assertEqual('1'); - expect(obj.$attrs.fontColor).assertEqual('#FF008000'); - expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Italic'); - expect(obj.$attrs.showDelete).assertEqual('false'); - console.info("[test_pieceCode_001] component obj is: " + JSON.stringify(obj)); - await Utils.sleep(1000); - done(); - }); - - it('test_pieceCode_002', 0, async function (done) { - console.info('[test_pieceCode_002] START'); - try { - let obj = { - content: 'piece test', - icon: '2', - } - let eventData = { - data: { - "pieceObj": JSON.stringify(obj) - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("[test_pieceCode_002] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[test_pieceCode_002] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('piece'); - let obj = JSON.parse(strJsonNew); - console.info("test_pieceCode_002 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.content).assertEqual("piece test"); - expect(obj.$attrs.icon).assertEqual("2"); - console.info('test_pieceCode_002 END'); - done(); - }); - - it('test_pieceCode_03', 0, async function (done) { - console.info('test_pieceCode_03 START'); - let strJson1 = getInspectorByKey('piece'); - let objLP = JSON.parse(strJson1); - console.info("testPatternLock_03 component objLP is: " + objLP.$attrs.sideLength); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "iconPosition": IconPosition.Start, - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("test_pieceCode_03 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("test_pieceCode_03 change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('piece'); - let obj = JSON.parse(strJson); - console.info("test_pieceCode_03 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.iconPosition).assertEqual("IconPosition.Start"); - console.info('test_pieceCode_03 END'); - done(); - }); - - it('test_pieceCode_04', 0, async function (done) { - console.info('test_pieceCode_04 START'); - let strJson1 = getInspectorByKey('piece'); - let objLP = JSON.parse(strJson1); - console.info("test_pieceCode_04 component objLP is: " + objLP.$attrs.sideLength); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "Color": '#FFFFB6C1', - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("test_pieceCode_04 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("test_pieceCode_04 change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('piece'); - let obj = JSON.parse(strJson); - console.info("test_pieceCode_04 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual("#FFFFB6C1"); - console.info('test_pieceCode_04 END'); - done(); - }); - - it('test_pieceCode_05', 0, async function (done) { - console.info('test_pieceCode_05 START'); - let strJson1 = getInspectorByKey('piece'); - let objLP = JSON.parse(strJson1); - console.info("test_pieceCode_05 component objLP is: " + objLP.$attrs.sideLength); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "fontStyle": FontStyle.Normal, - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("test_pieceCode_05 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("test_pieceCode_05 change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('piece'); - let obj = JSON.parse(strJson); - console.info("test_pieceCode_05 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontStyle).assertEqual("FontStyle.Normal"); - console.info('test_pieceCode_05 END'); - done(); - }); - - it('test_pieceCode_06', 0, async function (done) { - console.info('test_pieceCode_06 START'); - let strJson1 = getInspectorByKey('piece'); - let objLP = JSON.parse(strJson1); - console.info("test_pieceCode_06 component objLP is: " + objLP.$attrs.sideLength); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "showDelete": true, - } - } - var innerEvent = { - eventId: 82, - priority: events_emitter.EventPriority.LOW - } - console.info("test_pieceCode_06 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("test_pieceCode_06 change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('piece'); - let obj = JSON.parse(strJson); - console.info("test_pieceCode_06 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.showDelete).assertEqual("true"); - console.info('test_pieceCode_06 END'); - done(); - }); - - it('test_pieceCode_07', 0, async function (done) { - console.info('test_pieceCode_07 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("test_pieceCode_07 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.showDelete).assertEqual(true); - } - let indexEvent = { - eventId: 80, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("test_pieceCode_07 on events_emitter err : " + JSON.stringify(err)); - } - console.info("test_pieceCode_07 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); - await Utils.sleep(1000); - var callback1 = (eventData) => { - console.info("test_pieceCode_07 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true); - } - var innerEventOne = { - eventId: 81, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEventOne, callback1); - } catch (err) { - console.info("test_pieceCode_07 on events_emitter err : " + JSON.stringify(err)); - } - console.info('test_pieceCode_07 END'); - done(); - }); - - }) -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SideBarJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SideBarJsunit.test.ets deleted file mode 100755 index afb2813ec1ae6a36325905f51800ab4890e3d9e2..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SideBarJsunit.test.ets +++ /dev/null @@ -1,199 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function sidebarJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/sideBar', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get sideBar state success " + JSON.stringify(pages)); - if (!("sideBar" == pages.name)) { - console.info("get sideBar success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push sideBar page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push sideBar page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(2000); - console.info("sideBar after each called"); - }); - - it('testSideBar001', 0, async function (done) { - console.info('[testSideBar001] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('sidebar'); - console.info("[testSideBar001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testSideBar001] width:" + obj.$attrs.width); - expect(obj.$attrs.width).assertEqual('10.000000vp'); - done(); - }); - - it('testSideBar002', 0, async function (done) { - console.info('testSideBar002 START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "widthValue": '20', - } - } - var innerEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("testSideBar002 start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("testSideBar002 change component color error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('sidebar'); - let obj = JSON.parse(strJson); - console.info("testSideBar002 component obj is: " + JSON.stringify(obj.$attrs.widthValue)); - expect(obj.$attrs.widthValue).assertEqual('20'); - done(); - }); - - it('testSideBar003', 0, async function (done) { - console.info('[testSideBar003] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('sidebar'); - console.info("[testSideBar003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testSideBar003] height:" + obj.$attrs.height); - expect(obj.$attrs.height).assertEqual('10.000000vp'); - done(); - }); - - it('testSideBar004', 0, async function (done) { - console.info('[testSideBar004] START'); - try { - let eventData = { - data: { - "heightValue":"30" - } - } - let indexEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSideBar004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testSideBar004] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('sidebar'); - console.info("[testSideBar004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testSideBar004] height:" + obj.$attrs.height); - expect(obj.$attrs.height).assertEqual('30'); - done(); - }); - - it('testSidebar005', 0, async function (done) { - console.info('[testSidebar005] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('sidebar'); - console.info("[testSidebar005] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testSidebar005] icons:" + obj.$attrs.icons); - expect(obj.$attrs.icons).assertEqual('10.000000vp'); - done(); - }); - - it('testSidebar006', 0, async function (done) { - console.info('[testSidebar006] START'); - await Utils.sleep(1000); - let iconsValue: object= {shown: string=20, hidden: string=30, switching:string=10 }; - try { - var eventData = { - data: { - "iconsValue": JSON.stringify(iconsValue) - } - } - var innerEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSidebar006] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testSidebar006] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('sidebar'); - let objNew = JSON.parse(strJsonNew); - console.info("[testSidebar006] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.icons.shown).assertEqual("20.000000"); - expect(objNew.$attrs.icons.hidden).assertEqual("30.000000"); - expect(objNew.$attrs.icons.switching).assertEqual("10.000000"); - done(); - }); - - it('testSidebar007', 0, async function (done) { - console.info('[testSidebar007] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('sidebar'); - console.info("[testSidebar007] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testSidebar007] controlButton:" + obj.$attrs.controlButton); - expect(obj.$attrs.controlButton).assertEqual('10.000000vp'); - done(); - }); - - it('testSidebar008', 0, async function (done) { - console.info('[testSidebar008] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "controlButton": controlButton.top - } - } - var innerEvent = { - eventId: 45, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSidebar008] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testSidebar008] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('sidebar'); - let objNew = JSON.parse(strJsonNew); - console.info("[testSidebar008] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.controlButton).assertEqual("controlButton.top"); - done(); - }); - }) -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets deleted file mode 100755 index f5e6cf5233e19553c48925fd3e1dccef4534a1d0..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets +++ /dev/null @@ -1,75 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils.ets'; - -export default function sourceTypeJsunit() { - beforeEach(async function (done) { - console.info("sourceType beforeEach start"); - let options = { - uri: 'pages/sourceType', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get sourceType state pages:" + JSON.stringify(pages)); - if (!("sourceType" == pages.name)) { - console.info("get sourceType state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push sourceType page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push sourceType page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("sourceType after each called"); - }); - - it('sourceTypeTest_0100', 0, async function (done) { - await Utils.sleep(1000) - let rect = await Utils.getComponentRect('button') - console.info("sourceTypeTest_0100 rectInfo is " + JSON.stringify(rect)); - let x_value = rect.left + (rect.right - rect.left) / 2 - let y_value = rect.top + (rect.bottom - rect.top) / 2 - console.info("sourceTypeTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); - let point: TouchObject = { id: 1, x: x_value, y: y_value, type: TouchType.Down} - var callback = (eventData) => { - console.info("sourceTypeTest_0100 get event state result is: " + JSON.stringify(eventData)); - let event = JSON.parse(eventData.data.event); - expect(event.source).assertEqual(0) - } - var innerEvent = { - eventId: 155, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEvent, callback) - } catch (err) { - console.info("sourceTypeTest_0100 on events_emitter err : " + JSON.stringify(err)); - } - console.info('sourceTypeTest_0100 sendTouchEvent :' + sendTouchEvent(point)); - await Utils.sleep(1000) - console.info('sourceTypeTest_0100 testSendTouchEvent END'); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets index bfff4fb513ca28872f5229fdf6fd080bf1daec69..c2fa85e8af7e90ba98c7fde695dd3d564e4df33a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets @@ -1,91 +1,91 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function stepperJsunit() { - describe('stepperTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/stepper', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get stepper state success " + JSON.stringify(pages)); - if (!("stepper" == pages.name)) { - console.info("get stepper state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(1000); - console.info("push stepper page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push stepper page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("stepper after each called"); - }); - - it('stepperTest_0100', 0, async function (done) { - console.info('stepperTest_0100 START'); - let strJson = getInspectorByKey('stepper'); - console.info("stepperTest_0100 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("stepperTest_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Stepper'); - expect(obj.$attrs.index).assertEqual('0'); - console.info('stepperTest_0100 END'); - done(); - }); - - it('stepperTest_0200', 0, async function (done) { - console.info('stepperTest_0200 START'); - let strJson = getInspectorByKey('stepper'); - console.info("stepperTest_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("stepperTest_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.index).assertEqual('0'); - try { - let eventData = { - data: { - "currentIndex": "1", - } - } - let indexEvent = { - eventId: 12, - priority: events_emitter.EventPriority.LOW - } - console.info("stepperTest_0200 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("stepperTest_0200 change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJsonNew = getInspectorByKey('stepper'); - let objNew = JSON.parse(strJsonNew); - console.info("stepperTest_0200 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.index).assertEqual('1'); - console.info('stepperTest_0200 END'); - done(); - }); - }) +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; +import events_emitter from '@ohos.events.emitter'; + +export default function stepperJsunit() { + describe('stepperTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/stepper', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stepper state success " + JSON.stringify(pages)); + if (!("stepper" == pages.name)) { + console.info("get stepper state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push stepper page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stepper page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stepper after each called"); + }); + + it('stepperTest_0100', 0, async function (done) { + console.info('stepperTest_0100 START'); + let strJson = getInspectorByKey('stepper'); + console.info("stepperTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("stepperTest_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Stepper'); + expect(obj.$attrs.index).assertEqual('0'); + console.info('stepperTest_0100 END'); + done(); + }); + + it('stepperTest_0200', 0, async function (done) { + console.info('stepperTest_0200 START'); + let strJson = getInspectorByKey('stepper'); + console.info("stepperTest_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("stepperTest_0200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.index).assertEqual('0'); + try { + let eventData = { + data: { + "currentIndex": "1", + } + } + let indexEvent = { + eventId: 202, + priority: events_emitter.EventPriority.LOW + } + console.info("stepperTest_0200 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("stepperTest_0200 change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJsonNew = getInspectorByKey('stepper'); + let objNew = JSON.parse(strJsonNew); + console.info("stepperTest_0200 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.index).assertEqual('1'); + console.info('stepperTest_0200 END'); + done(); + }); + }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwipeDirectionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwipeDirectionJsunit.test.ets deleted file mode 100755 index 6a629749e9403abff42ac65cba1790099aaf85f8..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwipeDirectionJsunit.test.ets +++ /dev/null @@ -1,94 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function fontWeightJsunit() { - describe('swipeDirectionTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/swipeDirection', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get swipeDirection state success " + JSON.stringify(pages)); - if (!("panel" == pages.name)) { - console.info("get swipeDirection state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(4000); - console.info("push swipeDirection page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push swipeDirection page error " + JSON.stringify(err)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("swipeDirection after each called"); - }); - - it('swipeDirectionText_0100', 0, async function (done) { - console.info('swipeDirectionText_0100 START'); - let strJson = getInspectorByKey('swipeDirection'); - console.info("swipeDirectionText_0100 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swipeDirectionText_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Flex'); - done(); - }); - - it('swipeDirectionText_0200', 0, async function (done) { - console.info('swipeDirectionText_0200 START'); - let strJson = getInspectorByKey('fontWeight'); - console.info("swipeDirectionText_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swipeDirectionText_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.direction).assertEqual('All'); - done(); - }); - - it('swipeDirectionText_0300', 0, async function (done) { - console.info('swipeDirectionText_0300 START'); - try { - let eventData = { - data: { - "direction": "None", - } - } - let indexEvent = { - eventId: 167, - priority: events_emitter.EventPriority.LOW - } - console.info("swipeDirectionText_0300 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("swipeDirectionText_0300 change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJsonNew = getInspectorByKey('swipeDirection'); - let objNew = JSON.parse(strJsonNew); - console.info("swipeDirectionText_0300 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.direction).assertEqual('None'); - console.info('swipeDirectionText_0300 END'); - done(); - }); - }) -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets index c4898d7448d1a32acaddbb082a705468b1453dea..a01204bab79077d45f8281e82e4d83fd709fe0d2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets @@ -1,299 +1,301 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; - -export default function swiperJsunit() { - describe('swiperTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/swiper', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get swiper state success " + JSON.stringify(pages)); - if (!("swiper" == pages.name)) { - console.info("get swiper state success " + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(1000); - console.info("push swiper page success " + JSON.stringify(result)); - } - } catch (err) { - console.error("push swiper page error: " + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("swiper after each called"); - }); - - it('swiperTest_0100', 0, async function (done) { - console.info('swiperTest_0100 START'); - let strJson = getInspectorByKey('swiper'); - console.info("swiperTest_0100 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swiperTest_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('Swiper'); - expect(obj.$attrs.index).assertEqual('1'); - done(); - }); - - it('swiperTest_0200', 0, async function (done) { - console.info('swiperTest_0200 START'); - let strJson = getInspectorByKey('swiper'); - console.info("swiperTest_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swiperTest_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.indicator).assertEqual('true'); - expect(obj.$attrs.loop).assertEqual('false'); - console.info('swiperTest_0200 END'); - done(); - }); - - it('swiperTest_0300', 0, async function (done) { - console.info('swiperTest_0300 START'); - let strJson = getInspectorByKey('swiper'); - console.info("swiperTest_0300 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swiperTest_0300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.duration).assertEqual('1000.000000'); - expect(obj.$attrs.vertical).assertEqual('false'); - console.info('swiperTest_0300 END'); - done(); - }); - - it('swiperTest_0400', 0, async function (done) { - console.info('swiperTest_0400 START'); - let strJson = getInspectorByKey('swiper'); - console.info("swiperTest_0400 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swiperTest_0400 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.autoPlay).assertEqual('true'); - expect(obj.$attrs.interval).assertEqual('4000'); - console.info('swiperTest_0400 END'); - done(); - }); - - it('swiperTest_0500', 0, async function (done) { - console.info('swiperTest_0500 START'); - let strJson = getInspectorByKey('swiper'); - console.info("swiperTest_0500 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("swiperTest_0500 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.itemSpace).assertEqual('0.000000vp'); - expect(obj.$attrs.disableSwipe).assertEqual('false'); - console.info('swiperTest_0500 END'); - done(); - }); - - it('swiperTest_0600', 0, async function (done) { - console.info('swiperTest_0600 START'); - try { - let eventData = { - data: { - "index": "3", - "autoPlay": "false", - } - } - let indexEvent = { - eventId: 17, - priority: events_emitter.EventPriority.LOW - } - console.info("swiperTest_0600 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("swiperTest_0600 change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJsonNew = getInspectorByKey('swiper'); - let objNew = JSON.parse(strJsonNew); - console.info("swiperTest_0600 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.index).assertEqual('3'); - expect(objNew.$attrs.autoPlay).assertEqual('false'); - console.info('swiperTest_0600 END'); - done(); - }); - - it('swiperTest_0700', 0, async function (done) { - console.info('swiperTest_0700 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("swiperTest_0700 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 18, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("swiperTest_0700 on events_emitter err : " + JSON.stringify(err)); - } - console.info("swiperTest_0700 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); - await Utils.sleep(1000); - console.info('swiperTest_0700 END'); - done(); - }); - - it('swiperTest_0800', 0, async function (done) { - console.info('swiperTest_0800 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("swiperTest_0800 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 19, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("swiperTest_0800 on events_emitter err : " + JSON.stringify(err)); - } - console.info("swiperTest_0800 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); - await Utils.sleep(1000); - console.info('swiperTest_0800 END'); - done(); - }); - - it('swiperTest_0900', 0, async function (done) { - console.info('swiperTest_0900 START'); - await Utils.sleep(1500); - let callbackOne = (indexEventOne) => { - console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEventOne)); - expect(indexEventOne.data.ACTION).assertEqual(true); - } - let indexEventOne = { - eventId: 19, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEventOne, callbackOne); - } catch (err) { - console.info("swiperTest_0900 on events_emitter err : " + JSON.stringify(err)); - } - console.info("swiperTest_0900 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 20, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("swiperTest_0900 on events_emitter err : " + JSON.stringify(err)); - } - console.info('swiperTest_0900 END'); - done(); - }); - - it('swiperTest_1000', 0, async function (done) { - console.info('swiperTest_1000 START'); - try { - let eventData = { - data: { - "loop": true, - "vertical": true, - } - } - let indexEvent = { - eventId: 55, - priority: events_emitter.EventPriority.LOW - } - console.info("swiperTest_1000 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("swiperTest_1000 change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJsonNew = getInspectorByKey('swiper'); - let objNew = JSON.parse(strJsonNew); - console.info("swiperTest_1000 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.loop).assertEqual('true'); - expect(objNew.$attrs.vertical).assertEqual('true'); - console.info('swiperTest_1000 END'); - done(); - }); - - - it('swiperTest_1100', 0, async function (done) { - console.info('swiperTest_1100 START'); - try { - let eventData = { - data: { - "interval": "3000", - "indicator": "false", - } - } - let indexEvent = { - eventId: 56, - priority: events_emitter.EventPriority.LOW - } - console.info("swiperTest_1100 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("swiperTest_1100 change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJsonNew = getInspectorByKey('swiper'); - let objNew = JSON.parse(strJsonNew); - console.info("swiperTest_1100 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.interval).assertEqual('3000'); - expect(objNew.$attrs.indicator).assertEqual('false'); - console.info('swiperTest_1100 END'); - done(); - }); - - it('swiperTest_1200', 0, async function (done) { - console.info('swiperTest_1200 START'); - try { - let eventData = { - data: { - "duration": "500", - "itemSpace": "1", - } - } - let indexEvent = { - eventId: 57, - priority: events_emitter.EventPriority.LOW - } - console.info("swiperTest_1200 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("swiperTest_1200 change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJsonNew = getInspectorByKey('swiper'); - let objNew = JSON.parse(strJsonNew); - console.info("swiperTest_1200 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.duration).assertEqual('500.000000'); - expect(objNew.$attrs.itemSpace).assertEqual('1.000000vp'); - console.info('swiperTest_1200 END'); - done(); - }); - }) +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; +import events_emitter from '@ohos.events.emitter'; + +export default function swiperJsunit() { + describe('swiperTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/swiper', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get swiper state success " + JSON.stringify(pages)); + if (!("swiper" == pages.name)) { + console.info("get swiper state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push swiper page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push swiper page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("swiper after each called"); + }); + + it('swiperTest_0100', 0, async function (done) { + console.info('swiperTest_0100 START'); + let strJson = getInspectorByKey('swiper'); + console.info("swiperTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("swiperTest_0100 component obj is: " + JSON.stringify(obj)); + console.info("swiperTest_0100 obj.$attrs.index: " + obj.$attrs.index); + console.info("swiperTest_0100 obj.$attrs.indicatorStyle: " + obj.$attrs.indicatorStyle); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.index).assertEqual('1'); + done(); + }); + + it('swiperTest_0200', 0, async function (done) { + console.info('swiperTest_0200 START'); + let strJson = getInspectorByKey('swiper'); + console.info("swiperTest_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("swiperTest_0200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.indicator).assertEqual('true'); + expect(obj.$attrs.loop).assertEqual('false'); + console.info('swiperTest_0200 END'); + done(); + }); + + it('swiperTest_0300', 0, async function (done) { + console.info('swiperTest_0300 START'); + let strJson = getInspectorByKey('swiper'); + console.info("swiperTest_0300 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("swiperTest_0300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.duration).assertEqual('1000.000000'); + expect(obj.$attrs.vertical).assertEqual('false'); + console.info('swiperTest_0300 END'); + done(); + }); + + it('swiperTest_0400', 0, async function (done) { + console.info('swiperTest_0400 START'); + let strJson = getInspectorByKey('swiper'); + console.info("swiperTest_0400 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("swiperTest_0400 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.autoPlay).assertEqual('true'); + expect(obj.$attrs.interval).assertEqual('4000'); + console.info('swiperTest_0400 END'); + done(); + }); + + it('swiperTest_0500', 0, async function (done) { + console.info('swiperTest_0500 START'); + let strJson = getInspectorByKey('swiper'); + console.info("swiperTest_0500 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("swiperTest_0500 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.itemSpace).assertEqual('0.00vp'); + expect(obj.$attrs.disableSwipe).assertEqual('false'); + console.info('swiperTest_0500 END'); + done(); + }); + + it('swiperTest_0600', 0, async function (done) { + console.info('swiperTest_0600 START'); + try { + let eventData = { + data: { + "index": "3", + "autoPlay": "false", + } + } + let indexEvent = { + eventId: 207, + priority: events_emitter.EventPriority.LOW + } + console.info("swiperTest_0600 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("swiperTest_0600 change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJsonNew = getInspectorByKey('swiper'); + let objNew = JSON.parse(strJsonNew); + console.info("swiperTest_0600 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.index).assertEqual('3'); + expect(objNew.$attrs.autoPlay).assertEqual('false'); + console.info('swiperTest_0600 END'); + done(); + }); + + it('swiperTest_0700', 0, async function (done) { + console.info('swiperTest_0700 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("swiperTest_0700 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual(true); + } + let indexEvent = { + eventId: 205, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("swiperTest_0700 on events_emitter err : " + JSON.stringify(err)); + } + console.info("swiperTest_0700 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); + await Utils.sleep(1000); + console.info('swiperTest_0700 END'); + done(); + }); + + it('swiperTest_0800', 0, async function (done) { + console.info('swiperTest_0800 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("swiperTest_0800 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual(true); + } + let indexEvent = { + eventId: 206, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("swiperTest_0800 on events_emitter err : " + JSON.stringify(err)); + } + console.info("swiperTest_0800 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); + await Utils.sleep(1000); + console.info('swiperTest_0800 END'); + done(); + }); + + it('swiperTest_0900', 0, async function (done) { + console.info('swiperTest_0900 START'); + await Utils.sleep(1500); + let callbackOne = (indexEventOne) => { + console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEventOne)); + expect(indexEventOne.data.ACTION).assertEqual(true); + } + let indexEventOne = { + eventId: 206, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEventOne, callbackOne); + } catch (err) { + console.info("swiperTest_0900 on events_emitter err : " + JSON.stringify(err)); + } + console.info("swiperTest_0900 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual(true); + } + let indexEvent = { + eventId: 204, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("swiperTest_0900 on events_emitter err : " + JSON.stringify(err)); + } + console.info('swiperTest_0900 END'); + done(); + }); + + it('swiperTest_1000', 0, async function (done) { + console.info('swiperTest_1000 START'); + try { + let eventData = { + data: { + "loop": true, + "vertical": true, + } + } + let indexEvent = { + eventId: 208, + priority: events_emitter.EventPriority.LOW + } + console.info("swiperTest_1000 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("swiperTest_1000 change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJsonNew = getInspectorByKey('swiper'); + let objNew = JSON.parse(strJsonNew); + console.info("swiperTest_1000 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.loop).assertEqual('true'); + expect(objNew.$attrs.vertical).assertEqual('true'); + console.info('swiperTest_1000 END'); + done(); + }); + + + it('swiperTest_1100', 0, async function (done) { + console.info('swiperTest_1100 START'); + try { + let eventData = { + data: { + "interval": "3000", + "indicator": "false", + } + } + let indexEvent = { + eventId: 209, + priority: events_emitter.EventPriority.LOW + } + console.info("swiperTest_1100 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("swiperTest_1100 change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJsonNew = getInspectorByKey('swiper'); + let objNew = JSON.parse(strJsonNew); + console.info("swiperTest_1100 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.interval).assertEqual('3000'); + expect(objNew.$attrs.indicator).assertEqual('false'); + console.info('swiperTest_1100 END'); + done(); + }); + + it('swiperTest_1200', 0, async function (done) { + console.info('swiperTest_1200 START'); + try { + let eventData = { + data: { + "duration": "500", + "itemSpace": "1", + } + } + let indexEvent = { + eventId: 210, + priority: events_emitter.EventPriority.LOW + } + console.info("swiperTest_1200 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("swiperTest_1200 change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJsonNew = getInspectorByKey('swiper'); + let objNew = JSON.parse(strJsonNew); + console.info("swiperTest_1200 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.duration).assertEqual('500.000000'); + expect(objNew.$attrs.itemSpace).assertEqual('1.00vp'); + console.info('swiperTest_1200 END'); + done(); + }); + }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextAreasunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextAreasunit.test.ets deleted file mode 100755 index fbb6e48e90c31fb0de0d6c9401beede37d828a6a..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextAreasunit.test.ets +++ /dev/null @@ -1,236 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function textAreaJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("textArea beforeEach start"); - let options = { - uri: 'pages/textArea', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get textArea state pages:" + JSON.stringify(pages)); - if (!("textArea" == pages.name)) { - console.info("get textArea state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push textArea page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push textArea page error:" + JSON.stringify(result)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("textArea after each called"); - }); - - it('textArea01', 0, async function (done) { - console.info('[textArea01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs).assertEqual('textArea'); - expect(obj.$attrs.fontSize).assertEqual('30'); - console.info('textArea01 END'); - done(); - }); - - it('textArea02', 0, async function (done) { - console.info('[textArea02] START'); - try { - var eventData = { - data: { - "fontSize": '50', - } - } - var innerEvent = { - eventId: 1115, - priority: events_emitter.EventPriority.LOW - } - console.info("[textArea02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textArea02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontSize).assertEqual('50'); - console.info('textArea02 END'); - done(); - }); - - it('textArea03', 0, async function (done) { - console.info('[textArea03] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Red'); - console.info('textArea03 END'); - done(); - }); - - it('textArea04', 0, async function (done) { - console.info('[textArea04] START'); - try { - var eventData = { - data: { - "fontColor": 'Color.Green', - } - } - var innerEvent = { - eventId: 1116, - priority: events_emitter.EventPriority.LOW - } - console.info("[textArea04] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textArea04] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Green'); - console.info('textArea04 END'); - done(); - }); - - it('textArea05', 0, async function (done) { - console.info('[testArea05] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea05] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center'); - console.info('textArea05 END'); - done(); - }); - - it('textArea06', 0, async function (done) { - console.info('[textArea06] START'); - try { - var eventData = { - data: { - "textAlign": 'TextAlign.Start', - } - } - var innerEvent = { - eventId: 1117, - priority: events_emitter.EventPriority.LOW - } - console.info("[textArea06] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textArea06] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('textArea'); - let obj = JSON.parse(strJson); - console.info("[textArea06] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); - console.info('textArea06 END'); - done(); - }); - - it('textArea07', 0, async function (done) { - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("textArea07 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 2020, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("textArea07 on events_emitter err : " + JSON.stringify(err)); - } - console.info('textArea07 END'); - done(); - }); - - it('textArea08', 0, async function (done) { - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("textArea08 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 2021, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("textArea08 on events_emitter err : " + JSON.stringify(err)); - } - console.info('textArea08 END'); - done(); - }); - - it('textArea09', 0, async function (done) { - console.info('[textArea09] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textArea09] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.Text).assertEqual('TextArea'); - console.info('textArea09 END'); - done(); - }); - - it('textArea09', 0, async function (done) { - console.info('[textArea09] START'); - try { - var eventData = { - data: { - "Text": 'TextArea_1', - } - } - var innerEvent = { - eventId: 1318, - priority: events_emitter.EventPriority.LOW - } - console.info("[textArea09] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textArea09] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textArea09] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.type).assertEqual('TextArea_1'); - console.info('textArea09 END'); - done(); - }); - }) -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets deleted file mode 100755 index 55e6dfc45dd267860b54c20a1082b6df12736d66..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets +++ /dev/null @@ -1,209 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function textClockJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("text beforeEach start"); - let options = { - uri: 'pages/textClock', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get text state pages:" + JSON.stringify(pages)); - if (!("text" == pages.name)) { - console.info("get text state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push text page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push text page error:" + JSON.stringify(result)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("text after each called"); - }); - - it('textClock01', 0, async function (done) { - console.info('[textClock01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs).assertEqual('textClock'); - expect(obj.$attrs.fontSize).assertEqual('30'); - console.info('textClock01 END'); - done(); - }); - - it('textClock02', 0, async function (done) { - console.info('[textClock02] START'); - try { - var eventData = { - data: { - "fontSize": '50', - } - } - var innerEvent = { - eventId: 1215, - priority: events_emitter.EventPriority.LOW - } - console.info("[textClock02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textClock02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontSize).assertEqual('50'); - console.info('textClock02 END'); - done(); - }); - - it('textClock03', 0, async function (done) { - console.info('[textClock03] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Red'); - console.info('textClock03 END'); - done(); - }); - - it('textClock04', 0, async function (done) { - console.info('[textClock04] START'); - try { - var eventData = { - data: { - "fontColor": 'Color.Blue', - } - } - var innerEvent = { - eventId: 1216, - priority: events_emitter.EventPriority.LOW - } - console.info("[textClock04] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textClock04] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Blue'); - console.info('textClock04 END'); - done(); - }); - - it('textClock05', 0, async function (done) { - console.info('[textClock05] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('textClock'); - let obj = JSON.parse(strJson); - console.info("[textClock05] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.format).assertEqual('hhmmss'); - console.info('textClock05 END'); - done(); - }); - - it('textClock06', 0, async function (done) { - console.info('[textClock06] START'); - try { - var eventData = { - data: { - "format": 'yyyymmmmss', - } - } - var innerEvent = { - eventId: 1217, - priority: events_emitter.EventPriority.LOW - } - console.info("[textClock06] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textClock06] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock06] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.format).assertEqual('yyyymmmmss'); - console.info('textClock06 END'); - done(); - }); - - it('textClock07', 0, async function (done) { - console.info('textClock07 START'); - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("textClock07 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 1129, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("textClock07 on events_emitter err : " + JSON.stringify(err)); - } - console.info("textClock07 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); - await Utils.sleep(1000); - console.info('textClock07 END'); - done(); - }); - - it('textClock10', 0, async function (done) { - console.info('[textClock10] START'); - try { - var eventData = { - data: { - "format": 'yyyymmmmss', - } - } - var innerEvent = { - eventId: 1217, - priority: events_emitter.EventPriority.LOW - } - console.info("[textClock10] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textClock10] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textClock10] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.Text).assertEqual('yyyymmmmss'); - console.info('textClock10 END'); - done(); - }); - }) -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets deleted file mode 100755 index 0d9777e774f468ca53235071b2e7cf36a342b593..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets +++ /dev/null @@ -1,236 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function textInputJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("textInput beforeEach start"); - let options = { - uri: 'pages/textInput', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get textInput state pages:" + JSON.stringify(pages)); - if (!("textInput" == pages.name)) { - console.info("get textInput state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push textInput page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push textInput page error:" + JSON.stringify(result)); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("textInput after each called"); - }); - - it('textInput01', 0, async function (done) { - console.info('[textInput01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs).assertEqual('textInput'); - expect(obj.$attrs.fontSize).assertEqual('30'); - console.info('textInput01 END'); - done(); - }); - - it('textInput02', 0, async function (done) { - console.info('[textInput02] START'); - try { - var eventData = { - data: { - "fontSize": '50', - } - } - var innerEvent = { - eventId: 1315, - priority: events_emitter.EventPriority.LOW - } - console.info("[textInput02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textInput02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontSize).assertEqual('50'); - console.info('textInput02 END'); - done(); - }); - - it('textInput03', 0, async function (done) { - console.info('[textInput04] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Red'); - console.info('textInput03 END'); - done(); - }); - - it('textInput04', 0, async function (done) { - console.info('[textInput04] START'); - try { - var eventData = { - data: { - "fontColor": 'Color.Green', - } - } - var innerEvent = { - eventId: 1316, - priority: events_emitter.EventPriority.LOW - } - console.info("[textInput04] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textInput04] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('Color.Green'); - console.info('textInput04 END'); - done(); - }); - - it('textInput05', 0, async function (done) { - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("textInput05 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 3020, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("textInput05 on events_emitter err : " + JSON.stringify(err)); - } - console.info('textInput05 END'); - done(); - }); - - it('textInput06', 0, async function (done) { - await Utils.sleep(1500); - let callback = (indexEvent) => { - console.info("textInput06 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 3021, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("textInput06 on events_emitter err : " + JSON.stringify(err)); - } - console.info('textInput06 END'); - done(); - }); - - it('textInput07', 0, async function (done) { - console.info('[textInput07] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput07] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.type).assertEqual('InputType.Normal'); - console.info('textInput07 END'); - done(); - }); - - it('textInput08', 0, async function (done) { - console.info('[textInput08] START'); - try { - var eventData = { - data: { - "type": 'TextAlign.Start', - } - } - var innerEvent = { - eventId: 1317, - priority: events_emitter.EventPriority.LOW - } - console.info("[textInput08] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textInput08] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('TextInput'); - let obj = JSON.parse(strJson); - console.info("[textInput08] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.type).assertEqual('TextAlign.Start'); - console.info('textInput08 END'); - done(); - }); - - it('textInput09', 0, async function (done) { - console.info('[textInput09] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textInput09] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.Text).assertEqual('TextInput'); - console.info('textInput09 END'); - done(); - }); - - it('textInput10', 0, async function (done) { - console.info('[textInput10] START'); - try { - var eventData = { - data: { - "Text": 'TextInput_1', - } - } - var innerEvent = { - eventId: 1118, - priority: events_emitter.EventPriority.LOW - } - console.info("[textInput10] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[textInput10] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('text'); - let obj = JSON.parse(strJson); - console.info("[textInput10] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.type).assertEqual('TextInput_1'); - console.info('textInput10 END'); - done(); - }); - }) -} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TextStyleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextStyleJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TextStyleJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextStyleJsunit.test.ets index b29d30a3d65a850f1e39c75ec86666225db612a8..67a43ebe2e993625c6558ff8e2e15a5302f7d9d9 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TextStyleJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextStyleJsunit.test.ets @@ -1,233 +1,233 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function textStyleJsunit() { - describe('textStyleTest', function () { - beforeEach(async function (done) { - let options = { - uri: 'pages/general-properties/textStyle', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get textStyle state pages:" + JSON.stringify(pages)); - if (!("textStyle" == pages.name)) { - console.info("get textStyle state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push textStyle page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push textStyle page error:" + err); - } - done(); - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("textStyle after each called"); - }); - - it('testTextStyle001', 0, async function (done) { - console.info('[testTextStyle001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('fontColor'); - console.info("[testTextStyle001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle001] fontColor: " + obj.$attrs.fontColor); - expect(obj.$attrs.fontColor).assertEqual('#FFFF0000'); - done(); - }); - - it('testTextStyle002', 0, async function (done) { - console.info('[testTextStyle002] START'); - try { - let eventData = { - data: { - "fontColor": Color.Blue - } - } - let indexEvent = { - eventId: 40, - priority: events_emitter.EventPriority.LOW - } - console.info("[testTextStyle002] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testTextStyle002] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('fontColor'); - console.info("[testTextStyle002] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle002] fontColor: " + obj.$attrs.fontColor); - expect(obj.$attrs.fontColor).assertEqual('#FF0000FF'); - done(); - }); - - it('testTextStyle003', 0, async function (done) { - console.info('[testTextStyle003] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('fontSize'); - console.info("[testTextStyle003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle003] fontSize: " + obj.$attrs.fontSize); - expect(obj.$attrs.fontSize).assertEqual('20'); - done(); - }); - - it('testTextStyle004', 0, async function (done) { - console.info('[testTextStyle004] START'); - try { - let eventData = { - data: { - "fontSize": 30 - } - } - let indexEvent = { - eventId: 41, - priority: events_emitter.EventPriority.LOW - } - console.info("[testTextStyle004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testTextStyle004] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('fontSize'); - console.info("[testTextStyle004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle004] fontSize: " + obj.$attrs.fontSize); - expect(obj.$attrs.fontSize).assertEqual('30'); - done(); - }); - - it('testTextStyle005', 0, async function (done) { - console.info('[testTextStyle005] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('fontStyle'); - console.info("[testTextStyle005] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle005] fontStyle: " + obj.$attrs.fontStyle); - expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Italic'); - done(); - }); - - it('testTextStyle006', 0, async function (done) { - console.info('[testTextStyle006] START'); - try { - let eventData = { - data: { - "fontStyle": FontStyle.Normal - } - } - let indexEvent = { - eventId: 42, - priority: events_emitter.EventPriority.LOW - } - console.info("[testTextStyle006] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testTextStyle006] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('fontStyle'); - console.info("[testTextStyle006] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle006] fontStyle: " + obj.$attrs.fontStyle); - expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Normal'); - done(); - }); - - it('testTextStyle007', 0, async function (done) { - console.info('[testTextStyle007] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('fontWeight'); - console.info("[testTextStyle007] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle007] fontWeight: " + obj.$attrs.fontWeight); - expect(obj.$attrs.fontWeight).assertEqual('FontWeight.700'); - done(); - }); - - it('testTextStyle008', 0, async function (done) { - console.info('[testTextStyle008] START'); - try { - let eventData = { - data: { - "fontWeight": 400 - } - } - let indexEvent = { - eventId: 43, - priority: events_emitter.EventPriority.LOW - } - console.info("[testTextStyle008] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testTextStyle008] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('fontWeight'); - console.info("[testTextStyle008] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle008] fontWeight: " + obj.$attrs.fontWeight); - expect(obj.$attrs.fontWeight).assertEqual('FontWeight.400'); - done(); - }); - - it('testTextStyle009', 0, async function (done) { - console.info('[testTextStyle009] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('fontFamily'); - console.info("[testTextStyle009] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle009] fontFamily: " + obj.$attrs.fontFamily); - expect(obj.$attrs.fontFamily).assertEqual('sans-serif'); - done(); - }); - - it('testTextStyle0010', 0, async function (done) { - console.info('[testTextStyle0010] START'); - try { - let eventData = { - data: { - "fontFamily": 'Arial' - } - } - let indexEvent = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - console.info("[testTextStyle0010] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testTextStyle0010] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('fontFamily'); - console.info("[testTextStyle0010] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testTextStyle0010] fontFamily: " + obj.$attrs.fontFamily); - expect(obj.$attrs.fontFamily).assertEqual('Arial'); - done(); - }); - }); +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function textStyleJsunit() { + describe('textStyleTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/textStyle', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textStyle state pages:" + JSON.stringify(pages)); + if (!("textStyle" == pages.name)) { + console.info("get textStyle state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textStyle page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push textStyle page error:" + err); + } + done(); + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textStyle after each called"); + }); + + it('testTextStyle001', 0, async function (done) { + console.info('[testTextStyle001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fontColor'); + console.info("[testTextStyle001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle001] fontColor: " + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000'); + done(); + }); + + it('testTextStyle002', 0, async function (done) { + console.info('[testTextStyle002] START'); + try { + let eventData = { + data: { + "fontColor": Color.Blue + } + } + let indexEvent = { + eventId: 37, + priority: events_emitter.EventPriority.LOW + } + console.info("[testTextStyle002] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testTextStyle002] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('fontColor'); + console.info("[testTextStyle002] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle002] fontColor: " + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#FF0000FF'); + done(); + }); + + it('testTextStyle003', 0, async function (done) { + console.info('[testTextStyle003] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fontSize'); + console.info("[testTextStyle003] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle003] fontSize: " + obj.$attrs.fontSize); + expect(obj.$attrs.fontSize).assertEqual('20.00fp'); + done(); + }); + + it('testTextStyle004', 0, async function (done) { + console.info('[testTextStyle004] START'); + try { + let eventData = { + data: { + "fontSize": 30 + } + } + let indexEvent = { + eventId: 38, + priority: events_emitter.EventPriority.LOW + } + console.info("[testTextStyle004] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testTextStyle004] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('fontSize'); + console.info("[testTextStyle004] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle004] fontSize: " + obj.$attrs.fontSize); + expect(obj.$attrs.fontSize).assertEqual('30.00fp'); + done(); + }); + + it('testTextStyle005', 0, async function (done) { + console.info('[testTextStyle005] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fontStyle'); + console.info("[testTextStyle005] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle005] fontStyle: " + obj.$attrs.fontStyle); + expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Italic'); + done(); + }); + + it('testTextStyle006', 0, async function (done) { + console.info('[testTextStyle006] START'); + try { + let eventData = { + data: { + "fontStyle": FontStyle.Normal + } + } + let indexEvent = { + eventId: 39, + priority: events_emitter.EventPriority.LOW + } + console.info("[testTextStyle006] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testTextStyle006] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('fontStyle'); + console.info("[testTextStyle006] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle006] fontStyle: " + obj.$attrs.fontStyle); + expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Normal'); + done(); + }); + + it('testTextStyle007', 0, async function (done) { + console.info('[testTextStyle007] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fontWeight'); + console.info("[testTextStyle007] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle007] fontWeight: " + obj.$attrs.fontWeight); + expect(obj.$attrs.fontWeight).assertEqual('FontWeight.700'); + done(); + }); + + it('testTextStyle008', 0, async function (done) { + console.info('[testTextStyle008] START'); + try { + let eventData = { + data: { + "fontWeight": 400 + } + } + let indexEvent = { + eventId: 40, + priority: events_emitter.EventPriority.LOW + } + console.info("[testTextStyle008] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testTextStyle008] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('fontWeight'); + console.info("[testTextStyle008] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle008] fontWeight: " + obj.$attrs.fontWeight); + expect(obj.$attrs.fontWeight).assertEqual('FontWeight.400'); + done(); + }); + + it('testTextStyle009', 0, async function (done) { + console.info('[testTextStyle009] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fontFamily'); + console.info("[testTextStyle009] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle009] fontFamily: " + obj.$attrs.fontFamily); + expect(obj.$attrs.fontFamily).assertEqual('sans-serif'); + done(); + }); + + it('testTextStyle0010', 0, async function (done) { + console.info('[testTextStyle0010] START'); + try { + let eventData = { + data: { + "fontFamily": 'Arial' + } + } + let indexEvent = { + eventId: 41, + priority: events_emitter.EventPriority.LOW + } + console.info("[testTextStyle0010] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testTextStyle0010] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('fontFamily'); + console.info("[testTextStyle0010] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testTextStyle0010] fontFamily: " + obj.$attrs.fontFamily); + expect(obj.$attrs.fontFamily).assertEqual('Arial'); + done(); + }); + }); } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchAbleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchAbleJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0bdc5f0c8fef5322bc553b8a98ad4709fd494adc --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchAbleJsunit.test.ets @@ -0,0 +1,79 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils.ets'; +import events_emitter from '@ohos.events.emitter'; + +export default function touchAbleJsunit() { + describe('touchAbleTest', function () { + beforeEach(async function (done) { + console.info("touchAble beforeEach start"); + let options = { + uri: 'pages/touchAble', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get touchAble state pages:" + JSON.stringify(pages)); + if (!("touchAble" == pages.name)) { + console.info("get touchAble state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push touchAble page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push touchAble page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("touchAble after each called"); + }); + + it('testTouchAble001', 0, async function (done) { + await Utils.sleep(1000) + let strJson = getInspectorByKey('ellipse'); + let obj = JSON.parse(strJson); + console.info("[testTouchAble001] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.focusable).assertEqual(false); + done(); + }); + + it('testTouchAble002', 0, async function (done) { + await Utils.sleep(1000); + var callbackTwo = (eventData) => { + console.info("[testTouchAble002] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual('Ellipse Clicked') + } + var innerEventTwo = { + eventId: 237, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEventTwo, callbackTwo) + } catch (err) { + console.info("[testTouchAble002] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testClickEvent001] sendEventByKey ' + JSON.stringify(sendEventByKey('ellipse', 10, ""))); + await Utils.sleep(1000) + console.info('[testTouchAble002] END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchJsunit.test.ets index 4f7f8da667b406736c168b57a97b6a2d641cf9a5..c2aa4df21ad2070fe5dfbeac5c352ba387743b73 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TouchJsunit.test.ets @@ -1,72 +1,72 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from '../Utils.ets'; - -export default function touchJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("touch beforeEach start"); - let options = { - uri: 'pages/general-properties/touch', - } - let result; - try{ - router.clear(); - let pages = router.getState(); - console.info("get touch state pages: " + JSON.stringify(pages)); - if(!("touch" == pages.name)){ - console.info("get touch state pages.name: " + JSON.stringify(pages.name)); - result = await router.push(options); - await Utils.sleep(2000); - console.info("push touch page result: " + JSON.stringify(result)); - } - }catch(err){ - console.error("push touch page error: " + err); - } - done() - }); - - afterEach(async function(){ - await Utils.sleep(1000); - console.info("touch after each called"); - }) - - it('testTouch01', 0, async function (done) { - console.info('[testTouch01] START'); - await Utils.sleep(1000); - try { - let callBackTouch = (backData) => { - console.info("testTouch01 get backEvent result is: " + JSON.stringify(backEvent)); - console.info("testTouch01 get flag result is: " + JSON.stringify(backData.data.ACTION)); - expect(backData.data.ACTION).assertEqual(true); - } - var backEvent = { - eventId: 51, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(backEvent, callBackTouch); - }catch(err) { - console.info("testTouch01 on touchEvent err : " + JSON.stringify(err)); - } - console.info("testTouch01 click result is: " + JSON.stringify(sendEventByKey('touch',10,""))); - console.info('[testTouch01] END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils.ets'; + +export default function touchJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("touch beforeEach start"); + let options = { + uri: 'pages/touch', + } + let result; + try{ + router.clear(); + let pages = router.getState(); + console.info("get touch state pages: " + JSON.stringify(pages)); + if(!("touch" == pages.name)){ + console.info("get touch state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push touch page result: " + JSON.stringify(result)); + } + }catch(err){ + console.error("push touch page error: " + err); + } + done() + }); + + afterEach(async function(){ + await Utils.sleep(1000); + console.info("touch after each called"); + }) + + it('testTouch01', 0, async function (done) { + console.info('[testTouch01] START'); + await Utils.sleep(1000); + try { + let callBackTouch = (backData) => { + console.info("testTouch01 get backEvent result is: " + JSON.stringify(backEvent)); + console.info("testTouch01 get flag result is: " + JSON.stringify(backData.data.ACTION)); + expect(backData.data.ACTION).assertEqual(true); + } + var backEvent = { + eventId: 43, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(backEvent, callBackTouch); + }catch(err) { + console.info("testTouch01 on touchEvent err : " + JSON.stringify(err)); + } + console.info("testTouch01 click result is: " + JSON.stringify(sendEventByKey('touch',10,""))); + console.info('[testTouch01] END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/VisibilityJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/VisibilityJsunit.test.ets rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets index 98e56d205c4419034f508b99d7712c8b56b10790..483d2dc329d9a43694cc9a37e39740c7f8eb857b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/VisibilityJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets @@ -1,112 +1,112 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils'; - -export default function visibilityJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("visibility beforeEach start"); - let options = { - uri: 'pages/general-properties/visibility', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get visibility state pages:" + JSON.stringify(pages)); - if (!("visibility" == pages.name)) { - console.info("get visibility state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push visibility page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push visibility page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("visibility after each called"); - }); - - it('testVisibility01', 0, async function (done) { - console.info('[testVisibility01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('box'); - let obj = JSON.parse(strJson); - console.info("[testVisibility01] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.visibility).assertEqual('Visibility.Visible'); - console.info('[testVisibility01] END'); - done(); - }); - - it('testVisibility02', 0, async function (done) { - console.info('[testVisibility02] START'); - try { - var eventData = { - data: { - "visibility": Visibility.Hidden, - } - } - var innerEvent = { - eventId: 90, - priority: events_emitter.EventPriority.LOW - } - console.info("[testVisibility02] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testVisibility02] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('box'); - let obj = JSON.parse(strJson); - console.info("[testVisibility02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.visibility).assertEqual('Visibility.Hidden'); - console.info('[testVisibility02] END'); - done(); - }); - - it('testVisibility03', 0, async function (done) { - console.info('[testVisibility03] START'); - try { - var eventData = { - data: { - "visibility": Visibility.None, - } - } - var innerEvent = { - eventId: 91, - priority: events_emitter.EventPriority.LOW - } - console.info("[testVisibility03] start to publish emit:" + JSON.stringify(eventData.data)); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testVisibility03] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('box'); - let obj = JSON.parse(strJson); - console.info("[testVisibility03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.visibility).assertEqual('Visibility.None'); - console.info('[testVisibility03] END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function visibilityJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("visibility beforeEach start"); + let options = { + uri: 'pages/visibility', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get visibility state pages:" + JSON.stringify(pages)); + if (!("visibility" == pages.name)) { + console.info("get visibility state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push visibility page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push visibility page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("visibility after each called"); + }); + + it('testVisibility01', 0, async function (done) { + console.info('[testVisibility01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility01] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.Visible'); + console.info('[testVisibility01] END'); + done(); + }); + + it('testVisibility02', 0, async function (done) { + console.info('[testVisibility02] START'); + try { + var eventData = { + data: { + "visibility": Visibility.Hidden, + } + } + var innerEvent = { + eventId: 47, + priority: events_emitter.EventPriority.LOW + } + console.info("[testVisibility02] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testVisibility02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.Hidden'); + console.info('[testVisibility02] END'); + done(); + }); + + it('testVisibility03', 0, async function (done) { + console.info('[testVisibility03] START'); + try { + var eventData = { + data: { + "visibility": Visibility.None, + } + } + var innerEvent = { + eventId: 48, + priority: events_emitter.EventPriority.LOW + } + console.info("[testVisibility03] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testVisibility03] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.None'); + console.info('[testVisibility03] END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets index 9c89b711171ed0962becd89191d481726fcb2764..b03f60189cace3b3ca40a9995271d72e44b4dffa 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets @@ -1,112 +1,112 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from './Utils'; - -export default function enableJsunit() { - describe('appInfoTest', function () { - beforeEach(async function (done) { - console.info("zIndex beforeEach start"); - let options = { - uri: 'pages/zIndex', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get zIndex state pages: " + JSON.stringify(pages)); - if (!("zIndex" == pages.name)) { - console.info("get zIndex state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push zIndex page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push zIndex page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("zIndex after each called"); - }); - - it('testZIndex01', 0, async function (done) { - console.info('[testZIndex01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('zIndex'); - let obj = JSON.parse(strJson); - console.info("[testZIndex01] obj is: " + JSON.stringify(obj.$attrs)); - expect(obj.$attrs.zIndex).assertEqual(1); - console.info('[testZIndex01] END'); - done(); - }); - - it('testZIndex02', 0, async function (done) { - console.info('[testZIndex02] START'); - try { - var eventData = { - data: { - "zIndex": 4 - } - } - var innerEvent = { - eventId: 84, - priority: events_emitter.EventPriority.LOW - } - console.info("[testZIndex02] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testZIndex02] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('zIndex'); - let obj = JSON.parse(strJson); - console.info("[testZIndex02] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.zIndex).assertEqual(4); - console.info('testZIndex02 END'); - done(); - }); - - it('testZIndex03', 0, async function (done) { - console.info('[testZIndex03] START'); - try { - var eventData = { - data: { - "zIndex": -5 - } - } - var innerEvent = { - eventId: 84, - priority: events_emitter.EventPriority.LOW - } - console.info("[testZIndex03] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testZIndex03] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('zIndex'); - let obj = JSON.parse(strJson); - console.info("[testZIndex03] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.zIndex).assertEqual(-5); - console.info('testZIndex03 END'); - done(); - }); - }) -} +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function zIndexJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("zIndex beforeEach start"); + let options = { + uri: 'pages/zIndex', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get zIndex state pages: " + JSON.stringify(pages)); + if (!("zIndex" == pages.name)) { + console.info("get zIndex state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push zIndex page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push zIndex page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("zIndex after each called"); + }); + + it('testZIndex01', 0, async function (done) { + console.info('[testZIndex01] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('zIndex'); + let obj = JSON.parse(strJson); + console.info("[testZIndex01] obj is: " + JSON.stringify(obj.$attrs)); + expect(obj.$attrs.zIndex).assertEqual(1); + console.info('[testZIndex01] END'); + done(); + }); + + it('testZIndex02', 0, async function (done) { + console.info('[testZIndex02] START'); + try { + var eventData = { + data: { + "zIndex": 4 + } + } + var innerEvent = { + eventId: 236, + priority: events_emitter.EventPriority.LOW + } + console.info("[testZIndex02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testZIndex02] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('zIndex'); + let obj = JSON.parse(strJson); + console.info("[testZIndex02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.zIndex).assertEqual(4); + console.info('testZIndex02 END'); + done(); + }); + + it('testZIndex03', 0, async function (done) { + console.info('[testZIndex03] START'); + try { + var eventData = { + data: { + "zIndex": -5 + } + } + var innerEvent = { + eventId: 236, + priority: events_emitter.EventPriority.LOW + } + console.info("[testZIndex03] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testZIndex03] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('zIndex'); + let obj = JSON.parse(strJson); + console.info("[testZIndex03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.zIndex).assertEqual(-5); + console.info('testZIndex03 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets deleted file mode 100755 index 3d1e14b7de1bac0d8d150fbfbe94feb8c40bfe2d..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets +++ /dev/null @@ -1,78 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function clickEventJsunit() { - beforeEach(async function (done) { - console.info("clickEvent beforeEach start"); - let options = { - uri: 'pages/general-properties/clickEvent', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get clickEvent state pages:" + JSON.stringify(pages)); - if (!("opacitySetting" == pages.name)) { - console.info("get clickEvent state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push clickEvent page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push clickEvent page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("clickEvent after each called"); - }); - - it('testClickEvent001', 0, async function (done) { - await Utils.sleep(1000) - let rect = await Utils.getComponentRect('button') - console.info("[testClickEvent001] rectInfo is " + JSON.stringify(rect)); - let x_value = rect.left + (rect.right - rect.left) / 2 - let y_value = rect.top + (rect.bottom - rect.top) / 2 - console.info("[testClickEvent001] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); - var callback = (eventData) => { - console.info("[testClickEvent001] get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true) - let event = JSON.parse(eventData.data.event); - expect(event.screenX).assertEqual(240) - expect(event.screenY).assertEqual(60) - expect(event.x).assertEqual(100) - expect(event.y).assertEqual(50) - } - var innerEvent = { - eventId: 30, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(innerEvent, callback) - } catch (err) { - console.info("[testClickEvent001] on events_emitter err : " + JSON.stringify(err)); - } - console.info('[testClickEvent001] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, ""))); - await Utils.sleep(1000) - console.info('[testClickEvent001] testSendTouchEvent END'); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ColorGradientJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ColorGradientJsunit.test.ets deleted file mode 100755 index 930f9afbb2f16e1a8b28467c75d6ee443be6dca8..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ColorGradientJsunit.test.ets +++ /dev/null @@ -1,190 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function colorGradientJsunit() { - beforeEach(async function (done) { - console.info("colorGradient beforeEach start"); - let options = { - uri: 'pages/general-properties/colorGradient', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get colorGradient state pages:" + JSON.stringify(pages)); - if (!("colorGradient" == pages.name)) { - console.info("get colorGradient state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push colorGradient page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push colorGradient page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("colorGradient after each called"); - }); - - it('testColorGradient001', 0, async function (done) { - console.info('[testColorGradient001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('linearGradient'); - let obj = JSON.parse(strJson); - console.info("[testColorGradient001] component obj is: " + JSON.stringify(obj.$attrs.linearGradient)); - expect(obj.$attrs.linearGradient.angle).assertEqual('90.000000px'); - expect(obj.$attrs.linearGradient.direction).assertEqual('GradientDirection.Left'); - expect(obj.$attrs.linearGradient.repeating).assertEqual('true'); - done(); - }); - - it('testColorGradient002', 0, async function (done) { - console.info('[testColorGradient002] START'); - await Utils.sleep(1000); - let linearGradientValue = { - angle: 80, - direction: GradientDirection.Top, - colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], - repeating: false - }; - try { - var eventData = { - data: { - "linearGradientValue": JSON.stringify(linearGradientValue) - } - } - var innerEvent = { - eventId: 31, - priority: events_emitter.EventPriority.LOW - } - console.info("[testColorGradient002] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testColorGradient002] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('linearGradient'); - let objNew = JSON.parse(strJsonNew); - console.info("[testColorGradient002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.linearGradient.angle).assertEqual('80.000000px'); - expect(objNew.$attrs.linearGradient.direction).assertEqual('GradientDirection.Top'); - expect(objNew.$attrs.linearGradient.repeating).assertEqual('false'); - done(); - }); - - it('testColorGradient003', 0, async function (done) { - await Utils.sleep(1000) - console.info('[testColorGradient003] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('sweepGradient'); - let obj = JSON.parse(strJson); - console.info("[testColorGradient003] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.sweepGradient.angle).assertEqual('359.000000px'); - expect(obj.$attrs.sweepGradient.start).assertEqual('0.000000px'); - expect(obj.$attrs.sweepGradient.repeating).assertEqual('true'); - done(); - }); - - it('testColorGradient004', 0, async function (done) { - console.info('[testColorGradient004] START'); - await Utils.sleep(1000); - let sweepGradientValue = { - center: [50, 50], - start: 10, - end: 356, - colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], - repeating: false - }; - try { - var eventData = { - data: { - "sweepGradientValue": JSON.stringify(sweepGradientValue) - } - } - var innerEvent = { - eventId: 32, - priority: events_emitter.EventPriority.LOW - } - console.info("[testColorGradient004] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testColorGradient004] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('sweepGradient'); - let objNew = JSON.parse(strJsonNew); - console.info("[testColorGradient004] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.sweepGradient.angle).assertEqual('356.000000px'); - expect(objNew.$attrs.sweepGradient.start).assertEqual('10.000000px'); - expect(objNew.$attrs.sweepGradient.repeating).assertEqual('false'); - done(); - }); - - it('testColorGradient005', 0, async function (done) { - await Utils.sleep(1000) - console.info('[testColorGradient005] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('radialGradient'); - let obj = JSON.parse(strJson); - console.info("[testColorGradient005] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.radialGradient.radius).assertEqual('60.000000vp'); - expect(obj.$attrs.radialGradient.center[0]).assertEqual('50.000000vp'); - expect(obj.$attrs.radialGradient.center[1]).assertEqual('50.000000vp'); - expect(obj.$attrs.radialGradient.repeating).assertEqual('true'); - done(); - }); - - it('testColorGradient006', 0, async function (done) { - console.info('[testColorGradient006] START'); - await Utils.sleep(1000); - let radialGradientValue = { - center: [60, 60], - radius: 70, - colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], - repeating: true - }; - try { - var eventData = { - data: { - "radialGradientValue": JSON.stringify(radialGradientValue) - } - } - var innerEvent = { - eventId: 33, - priority: events_emitter.EventPriority.LOW - } - console.info("[testColorGradient006] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testColorGradient006] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('sweepGradient'); - let objNew = JSON.parse(strJsonNew); - console.info("[testColorGradient006] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.radialGradient.radius).assertEqual('70.000000vp'); - expect(objNew.$attrs.radialGradient.center[0]).assertEqual('60.000000vp'); - expect(objNew.$attrs.radialGradient.center[1]).assertEqual('60.000000vp'); - expect(objNew.$attrs.radialGradient.repeating).assertEqual('false'); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/OpacitySettingJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/OpacitySettingJsunit.test.ets deleted file mode 100755 index 458f18f6908b7281075fd69e69c34f4b252c9fa8..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/OpacitySettingJsunit.test.ets +++ /dev/null @@ -1,82 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from '../Utils.ets'; - -export default function opacitySettingJsunit() { - beforeEach(async function (done) { - console.info("opacitySetting beforeEach start"); - let options = { - uri: 'pages/general-properties/opacitySetting', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get opacitySetting state pages:" + JSON.stringify(pages)); - if (!("opacitySetting" == pages.name)) { - console.info("get opacitySetting state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push opacitySetting page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push opacitySetting page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("opacitySetting after each called"); - }); - - it('testOpacitySetting001', 0, async function (done) { - console.info('[testOpacitySetting001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('opacity'); - let obj = JSON.parse(strJson); - console.info("[testOpacitySetting001] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.opacity).assertEqual(1); - done(); - }); - - it('testOpacitySetting002', 0, async function (done) { - console.info('[testOpacitySetting002] START'); - try { - var eventData = { - data: { - "opacityValue": "0.7" - } - } - var innerEvent = { - eventId: 100, - priority: events_emitter.EventPriority.LOW - } - console.info("[testOpacitySetting002] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testOpacitySetting002] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('opacity'); - let objNew = JSON.parse(strJsonNew); - console.info("[testOpacitySetting002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.opacity).assertEqual(0.7); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PositionSettingJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PositionSettingJsunit.test.ets deleted file mode 100755 index f24dbdfbf41fcd8b012669c4b05e4c21e112dad0..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PositionSettingJsunit.test.ets +++ /dev/null @@ -1,259 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function positionSettingJsunit() { - beforeEach(async function (done) { - console.info("positionSetting beforeEach start"); - let options = { - uri: 'pages/general-properties/positionSetting', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get positionSetting state pages:" + JSON.stringify(pages)); - if (!("positionSetting" == pages.name)) { - console.info("get positionSetting state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push positionSetting page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push positionSetting page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("positionSetting after each called"); - }); - - it('testPositionSetting001', 0, async function (done) { - console.info('[testPositionSetting001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('textAlign'); - console.info("[testPositionSetting001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign); - expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); - done(); - }); - - it('testPositionSetting002', 0, async function (done) { - console.info('[testPositionSetting002] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('rowDirection'); - console.info("[testPositionSetting002] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting002] rowDirection: " + obj.$attrs.direction); - expect(obj.$attrs.direction).assertEqual('Direction.Rtl'); - done(); - }); - - it('testPositionSetting003', 0, async function (done) { - console.info('[testPositionSetting003] START'); - try { - let eventData = { - data: { - "textAlign": Alignment.BottomEnd - } - } - let indexEvent = { - eventId: 21, - priority: events_emitter.EventPriority.LOW - } - console.info("[testPositionSetting003] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testPositionSetting003] change component data error: " + err.message); - } - await Utils.sleep(4000); - let strJson = getInspectorByKey('textAlign'); - console.info("[testPositionSetting003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting003] textAlign: " + obj.$attrs.textAlign); - expect(obj.$attrs.textAlign).assertEqual('TextAlign.BottomEnd'); - done(); - }); - - it('testPositionSetting004', 0, async function (done) { - console.info('[testPositionSetting004] START'); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "direction": Direction.Ltr - } - } - let indexEvent = { - eventId: 22, - priority: events_emitter.EventPriority.LOW - } - console.info("[testPositionSetting004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testPositionSetting004] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('rowDirection'); - console.info("[testPositionSetting004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting004] rowDirection: " + obj.$attrs.direction); - expect(obj.$attrs.direction).assertEqual('Direction.Ltr'); - done(); - }); - - it('testPositionSetting005', 0, async function (done) { - console.info('[testPositionSetting005] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('position1'); - console.info("[testPositionSetting005] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting005] position: " + JSON.stringify(obj.$attrs.position)); - expect(obj.$attrs.position.x).assertEqual('25.000000vp'); - expect(obj.$attrs.position.y).assertEqual('15.000000vp'); - let strJson1 = getInspectorByKey('position2'); - console.info("[testPositionSetting005] component strJson1:" + strJson1); - let obj1 = JSON.parse(strJson1); - console.info("[testPositionSetting005] position1: " + JSON.stringify(obj1.$attrs.position)); - expect(obj1.$attrs.position.x).assertEqual('50.000000%'); - expect(obj1.$attrs.position.y).assertEqual('70.000000%'); - done(); - }); - - it('testPositionSetting006', 0, async function (done) { - console.info('[testPositionSetting006] START'); - await Utils.sleep(1000); - try { - let data = {x: 10, y: 25}; - let data2 = {x: '30%', y: '50%'}; - let eventData = { - data: { - "position1": JSON.stringify(data), - "position2": JSON.stringify(data2) - } - } - let indexEvent = { - eventId: 23, - priority: events_emitter.EventPriority.LOW - } - console.info("[testPositionSetting006] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testPositionSetting006] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('position1'); - console.info("[testPositionSetting006] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting006] position1: " + JSON.stringify(obj.$attrs.position)); - expect(obj.$attrs.position.x).assertEqual('10.000000vp'); - expect(obj.$attrs.position.y).assertEqual('25.000000vp'); - let strJson2 = getInspectorByKey('position2'); - console.info("[testPositionSetting006] component strJson2:" + strJson2); - let obj2 = JSON.parse(strJson2); - console.info("[testPositionSetting006] position2: " + JSON.stringify(obj2.$attrs.position)); - expect(obj2.$attrs.position.x).assertEqual('30.000000%'); - expect(obj2.$attrs.position.y).assertEqual('50.000000%'); - done(); - }); - - it('testPositionSetting007', 0, async function (done) { - console.info('[testPositionSetting007] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('markAnchor'); - console.info("[testPositionSetting007] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting007] position: " + JSON.stringify(obj.$attrs.markAnchor)); - expect(obj.$attrs.markAnchor.x).assertEqual('25.000000vp'); - expect(obj.$attrs.markAnchor.y).assertEqual('25.000000vp'); - done(); - }); - - it('testPositionSetting008', 0, async function (done) { - console.info('[testPositionSetting008] START'); - await Utils.sleep(1000); - try { - let data = {x: 0, y: 0}; - let eventData = { - data: { - "markAnchor": JSON.stringify(data), - } - } - let indexEvent = { - eventId: 24, - priority: events_emitter.EventPriority.LOW - } - console.info("[testPositionSetting008] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testPositionSetting008] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('markAnchor'); - console.info("[testPositionSetting008] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting008] markAnchor: " + JSON.stringify(obj.$attrs.markAnchor)); - expect(obj.$attrs.markAnchor.x).assertEqual('0.000000vp'); - expect(obj.$attrs.markAnchor.y).assertEqual('0.000000vp'); - done(); - }); - - it('testPositionSetting009', 0, async function (done) { - console.info('[testPositionSetting009] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('offset'); - console.info("[testPositionSetting009] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting009] offset: " + JSON.stringify(obj.$attrs.offset)); - expect(obj.$attrs.offset.x).assertEqual('10.000000vp'); - expect(obj.$attrs.offset.y).assertEqual('15.000000vp'); - done(); - }); - - it('testPositionSetting010', 0, async function (done) { - console.info('[testPositionSetting010] START'); - await Utils.sleep(1000); - try { - let data = {x: 150, y: 10}; - let eventData = { - data: { - "offset": JSON.stringify(data), - } - } - let indexEvent = { - eventId: 25, - priority: events_emitter.EventPriority.LOW - } - console.info("[testPositionSetting010] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testPositionSetting010] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('offset'); - console.info("[testPositionSetting010] component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("[testPositionSetting010] offset: " + JSON.stringify(obj.$attrs.offset)); - expect(obj.$attrs.offset.x).assertEqual('150.000000vp'); - expect(obj.$attrs.offset.y).assertEqual('10.000000vp'); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ShapeClippingJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ShapeClippingJsunit.test.ets deleted file mode 100755 index a444afd26a6eab3c17d69b9b7a4705191b2276b0..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ShapeClippingJsunit.test.ets +++ /dev/null @@ -1,127 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function shapeClippingJsunit() { - beforeEach(async function (done) { - console.info("shapeClipping beforeEach start"); - let options = { - uri: 'pages/general-properties/shapeClipping', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get shapeClipping state pages:" + JSON.stringify(pages)); - if (!("shapeClipping" == pages.name)) { - console.info("get shapeClipping state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push shapeClipping page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push shapeClipping page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("shapeClipping after each called"); - }); - - it('testShapeClipping001', 0, async function (done) { - console.info('[testShapeClipping001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('image_clip'); - let obj = JSON.parse(strJson); - console.info("[testShapeClipping001] component obj is: " + JSON.stringify(obj)); - let clip = JSON.parse(obj.$attrs.clip); - expect(clip.shape).assertEqual('Circle'); - - let strJson1 = getInspectorByKey('image_clip_true'); - let obj1 = JSON.parse(strJson1); - console.info("[testShapeClipping001] component obj1 is: " + JSON.stringify(obj1)); - expect(obj1.$attrs.clip).assertEqual('true'); - done(); - }); - - it('testShapeClipping002', 0, async function (done) { - console.info('[testShapeClipping002] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('image_mask'); - let obj = JSON.parse(strJson); - console.info("[testShapeClipping002] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.mask.shape).assertEqual('Rect'); - expect(obj.$attrs.clip).assertEqual('false'); - done(); - }); - - - it('testShapeClipping003', 0, async function (done) { - console.info('[testShapeClipping003] START'); - try { - var eventData = { - data: { - "maskValue": false - } - } - var innerEvent = { - eventId: 99, - priority: events_emitter.EventPriority.LOW - } - console.info("[testShapeClipping003] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testShapeClipping003] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('image_mask'); - let objNew = JSON.parse(strJsonNew); - console.info("[testShapeClipping003] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.mask.shape).assertEqual('Circle'); - done(); - }); - - it('testShapeClipping004', 0, async function (done) { - console.info('[testShapeClipping004] START'); - try { - var eventData = { - data: { - "clipValue": false - } - } - var innerEvent = { - eventId: 98, - priority: events_emitter.EventPriority.LOW - } - console.info("[testShapeClipping004] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testShapeClipping004] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('image_clip'); - let objNew = JSON.parse(strJsonNew); - console.info("[testShapeClipping004] component objNew is: " + JSON.stringify(objNew)); - let clip = JSON.parse(objNew.$attrs.clip); - expect(clip.shape).assertEqual('Rect'); - done(); - }); - -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/SizeSettingJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/SizeSettingJsunit.test.ets deleted file mode 100755 index a5f5d3b85bb95f6d4106fa1d9335ee11b209aaa7..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/SizeSettingJsunit.test.ets +++ /dev/null @@ -1,166 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils.ets'; - -export default function sizeSettingJsunit() { - beforeEach(async function (done) { - console.info("sizeSetting beforeEach start"); - let options = { - uri: 'pages/general-properties/sizeSetting', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get sizeSetting state pages:" + JSON.stringify(pages)); - if (!("sizeSetting" == pages.name)) { - console.info("get sizeSetting state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push sizeSetting page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push sizeSetting page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("sizeSetting after each called"); - }); - - it('testSizeSetting001', 0, async function (done) { - console.info('[testSizeSetting001] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('centerRow'); - console.info("[testSizeSetting001] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.width).assertEqual('80.000000vp'); - expect(obj.$attrs.height).assertEqual('80.000000vp'); - expect(obj.$attrs.padding).assertEqual('20.000000vp'); - expect(obj.$attrs.margin).assertEqual('20.000000vp'); - done(); - }); - - it('testSizeSetting002', 0, async function (done) { - console.info('[testSizeSetting002] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('innerRow'); - console.info("[testSizeSetting002] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.width).assertEqual('100.000000%'); - expect(obj.$attrs.height).assertEqual('100.000000%'); - done(); - }); - - it('testSizeSetting003', 0, async function (done) { - console.info('[testSizeSetting003] START'); - try { - let eventData = { - data: { - "width": '200', - "height": '200', - "padding": '10', - "margin": '40' - } - } - let indexEvent = { - eventId: 28, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSizeSetting003] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testSizeSetting003] change component data error: " + err.message); - } - await Utils.sleep(1000); - let strJson = getInspectorByKey('centerRow'); - console.info("[testSizeSetting003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.width).assertEqual('200.000000vp'); - expect(obj.$attrs.height).assertEqual('200.000000vp'); - expect(obj.$attrs.padding).assertEqual('10.000000vp'); - expect(obj.$attrs.margin).assertEqual('40.000000vp'); - done(); - }); - - it('testSizeSetting004', 0, async function (done) { - console.info('[testSizeSetting004] START'); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "width": '80%', - "height": '80%' - } - } - let indexEvent = { - eventId: 29, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSizeSetting004] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testSizeSetting004] change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJson = getInspectorByKey('innerRow'); - console.info("[testSizeSetting004] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.width).assertEqual('80.000000%'); - expect(obj.$attrs.height).assertEqual('80.000000%'); - done(); - }); - - it('testSizeSetting005', 0, async function (done) { - console.info('[testSizeSetting005] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('layoutWeight1'); - console.info("[testSizeSetting005] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.layoutWeight).assertEqual(1); - done(); - }); - - it('testSizeSetting006', 0, async function (done) { - console.info('[testSizeSetting006] START'); - await Utils.sleep(1000); - try { - let eventData = { - data: { - "weight": '3' - } - } - let indexEvent = { - eventId: 32, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSizeSetting006] start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("[testSizeSetting006] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJson = getInspectorByKey('layoutWeight1'); - console.info("[testSizeSetting006] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.layoutWeight).assertEqual(3); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchAbleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchAbleJsunit.test.ets deleted file mode 100755 index da032c948cd7af66d6b82982055f28682cbd5b0d..0000000000000000000000000000000000000000 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchAbleJsunit.test.ets +++ /dev/null @@ -1,55 +0,0 @@ -// @ts-nocheck -/** - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import Utils from '../Utils.ets'; - -export default function touchAbleJsunit() { - beforeEach(async function (done) { - console.info("touchAble beforeEach start"); - let options = { - uri: 'pages/general-properties/touchAble', - } - try { - router.clear(); - let pages = router.getState(); - console.info("get touchAble state pages:" + JSON.stringify(pages)); - if (!("touchAble" == pages.name)) { - console.info("get touchAble state pages.name:" + JSON.stringify(pages.name)); - let result = await router.push(options); - await Utils.sleep(2000); - console.info("push touchAble page result:" + JSON.stringify(result)); - } - } catch (err) { - console.error("push touchAble page error:" + err); - } - done() - }); - - afterEach(async function () { - await Utils.sleep(1000); - console.info("touchAble after each called"); - }); - - it('testTouchAble001', 0, async function (done) { - await Utils.sleep(1000) - let strJson = getInspectorByKey('ellipse'); - let obj = JSON.parse(strJson); - console.info("[testTouchAble001] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.touchable).assertEqual(false); - done(); - }); -} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/utils/Constants.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/utils/Constants.ets index 1f0ab94537426e4732d63297403d99c1abe19543..be2b5c8faeeee48bca5c968137dc28e1ffb9bc4d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/utils/Constants.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -1,111 +1,112 @@ -/** - * 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. - */ -const TYPE = '$type' -const ID = '$ID' -const Z_INDEX = '$z-index' -const RECT = '$rect' -const DEBUGLINE = '$debugLine' -const ATTRS = '$attrs' -const ATTRS_SEPIA = 'sepia' -const ATTRS_ASPECTRATIO = 'aspectRatio' -const ATTRS_CONTRAST = 'contrast' -const ATTRS_SATURATE = 'saturate' -const ATTRS_HUEROTATE = 'hueRotate' -const ATTRS_INVERT = 'invert' -const ATTRS_BRIGHTNESS = 'brightness' -const ATTRS_BACKDROPBLUR = 'backdropBlur' -const ATTRS_GRAYSCALE = 'grayscale' -const ATTRS_BLUR = 'blur' -const ATTRS_GRIDOFFSET = 'gridOffset' -const ATTRS_FLEXSHRINK = 'flexShrink' -const ATTRS_FLEXGROW = 'flexGrow' -const ATTRS_OPACITY = 'opacity' -const ATTRS_DIRECTION = 'direction' -const ATTRS_ALIGN = 'align' -const ATTRS_HEIGHT = 'height' -const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' -const ATTRS_ALIGNSELF = 'alignSelf' -const ATTRS_BORDERWIDTH = 'borderWidth' -const ATTRS_WIDTH = 'width' -const ATTRS_BORDERCOLOR = 'borderColor' -const ATTRS_MARGIN_BOTTOM = 'margin-bottom' -const ATTRS_BORDERSTYLE = 'borderStyle' -const ATTRS_MARGIN_RIGHT = 'margin-right' -const ATTRS_CONSTRAINTSIZE = 'constraintSize' -const ATTRS_NARGIN_LEFT = 'margin-left' -const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' -const ATTRS_MARGIN_TOP = 'margin-top' -const ATTRS_BORDERRADIUS = 'borderRadius' -const ATTRS_FLEXBASIC = 'flexBasis' -const ATTRS_VISIBILITY = 'visibility' -const ATTRS_PASSWORD = 'password' -const ATTRS_CHECKED = 'checked' -const ATTRS_SELECTED = 'selected' -const ATTRS_LONG_CLICKABLE = 'long-clickable' -const ATTRS_FOCUSED = 'focused' -const ATTRS_SCROLLABLE = 'scrollable' -const ATTRS_CLICKABLE = 'clickable' -const ATTRS_FOCUSABLE = 'focusable' -const ATTRS_CHECKABLE = 'checkable' -const ATTRS_CLIP = 'clip' -const ATTRS_ENABLE = 'enabled' -const ATTRS_DISPLAYPRIORITY = 'displayPriority' -const ATTRS_LAYOUTWEIGHT = 'layoutWeight' -const ATTRS_LAYOUTPRIORITY = 'layoutPriority' -const ATTRS_GRIDSPAN = 'gridSpan' -const ATTRS_ZINDEX = 'zIndex' -const ATTRS_USEALIGN = 'useAlign' -const ATTRS_USEALIGN_EDGE = 'edge' -const ATTRS_USEALIGN_OFFSET = 'offset' -const ATTRS_MASK = 'mask' -const ATTRS_MARKANCHOR = 'markAnchor' -const ATTRS_MARKANCHOR_X = 'x' -const ATTRS_MARKANCHOR_Y = 'y' -const ATTRS_PADDING = 'padding' -const ATTRS_POSITION = 'position' -const ATTRS_POSITION_X = 'x' -const ATTRS_POSITION_Y = 'y' -const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' -const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' -const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' -const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' -const ATTRS_OFFSET = 'offset' -const ATTRS_OFFSET_X = 'x' -const ATTRS_OFFSET_Y = 'y' -const ATTRS_SHADOW = 'shadow' -const ATTRS_SHADOW_RADIUS = 'radius' -const ATTRS_SHADOW_COLOR = 'color' -const ATTRS_SHADOW_OFFSETX = 'offsetX' -const ATTRS_SHADOW_OFFSETY = 'offsetY' -const ATTRS_WINDOWBLUR = 'windowBlur' -const ATTRS_WINDOWBLUR_PERCENT = 'percent' -const ATTRS_WINDOWBLUR_STYLE = 'style' -const ATTRS_FONTFAMILY = 'fontFamily' -const ATTRS_FONTWEIGHT = 'fontWeight' -const ATTRS_FONTSTYLE = 'fontStyle' -const ATTRS_FONTSIZE = 'fontSize' -const ATTRS_TEXTCASE = 'textCase' -const ATTRS_MAXLINES = 'maxLines' -const ATTRS_DECORATION = 'decoration' -const ATTRS_BASELINEOFFSET = 'baselineOffset' -const ATTRS_TEXTOVERFLOW = 'textOverflow' -const ATTRS_LINEHEIGHT = 'lineHeight' -const ATTRS_FONTCOLOR = 'fontColor' -const ATTRS_TEXTALIGN = 'textAlign' -const ATTRS_CONTENT = 'content' - - - - +// @ts-nocheck +/** + * 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/ace/ace_ets_component_five/BUILD.gn b/ace/ace_ets_component_five/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8db306734352283251f80367c1c28116a5e9c141 --- /dev/null +++ b/ace/ace_ets_component_five/BUILD.gn @@ -0,0 +1,32 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("AceEtsComponentFiveTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_component_assets", + ":ace_ets_component_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AceEtsComponentFiveTest" +} +ohos_js_assets("ace_ets_component_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("ace_ets_component_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ace/ace_ets_component_five/Test.json b/ace/ace_ets_component_five/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..78b36d7f3fe6d9631591f062e559ce3853e3c7a1 --- /dev/null +++ b/ace/ace_ets_component_five/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.open.harmony.acetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "AceEtsComponentFiveTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ace/ace_ets_component_five/entry/src/main/config.json b/ace/ace_ets_component_five/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..43b53d70984ca8bb1eaad8677881389611be8550 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/config.json @@ -0,0 +1,89 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetestfive", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.acetestfive", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.acetestfive.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/checkbox", + "pages/enumsImage", + "pages/fillMode", + "pages/ohosMatrix4", + "pages/select", + "pages/colorGradient", + "pages/checkboxGroup", + "pages/edgeEffect", + "pages/slider", + "pages/backgroundAndSizeSetting", + "pages/border", + "pages/positionSetting", + "pages/shapeClipping", + "pages/transForm", + "pages/visibility", + "pages/enumsFlexAlign", + "pages/enumsVerticalAlign", + "pages/enumsHorizontalAlign" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets similarity index 64% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets index d7f919aab16c828ac3e34739966660d952cdee8d..52891e5511c95df08fd3e9965805e768c465e9ff 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/app.ets @@ -13,15 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -@Entry -@Component -struct NavigatorBackCode { - build() { - Column() { - Navigator({ target: 'pages/NavigatorCode', type: NavigationType.Back }) { - Text('Return to Navigator Page').width('100%').textAlign(TextAlign.Center) - } - }.width('100%').height(200).padding({ left: 35, right: 35, top: 35 }) - } +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, } \ No newline at end of file diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/bg.jpg b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/bg.jpg differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/clip.png b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/clip.png new file mode 100755 index 0000000000000000000000000000000000000000..8bf4be4ee8ed5f13f3c3f8e4881a898199e4a57c Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/clip.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/dialog.png b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/dialog.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/dialog.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/download.png b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/download.png new file mode 100755 index 0000000000000000000000000000000000000000..3b1d0fd10bd28897bf3b1103e5bdba0fdb9d17f1 Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/download.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/ic_health_heart.png b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/ic_health_heart.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.jpeg b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..30c4e9ecfe8396d327dfd5cf0528a43a4714db44 Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.jpeg differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.png b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.png new file mode 100755 index 0000000000000000000000000000000000000000..2a10f82cfa60d94e7a1ba9a613736739729c0cf6 Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/images/img.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/backgroundAndSizeSetting.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/backgroundAndSizeSetting.ets new file mode 100755 index 0000000000000000000000000000000000000000..77d9ca339b65b8315e84b3d89da9e6ae9e7e4d0c --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/backgroundAndSizeSetting.ets @@ -0,0 +1,233 @@ +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct BackgroundExample { + @State width: string = "200px"; + @State height: string = "200px"; + @State color: Array = [[0x080808], [0xEEEE00], [0xFF0000]]; + @State width: string = 80; + @State height: string = 80; + @State padding: string = 20; + @State margin: string = 20; + @State sizeWidth: string = '100%'; + @State sizeHeight: string = '100%'; + @State layoutWeight1: string = 1; + @State layoutWeight2: string = 2; + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("gauge page state change called:" + JSON.stringify(eventData)); + if(eventData.data.colorValues != null) { + this.colorValues = JSON.parse(eventData.data.colorValues); + } + if(eventData.data.width != null) { + this.width = eventData.data.width; + } + if(eventData.data.height != null) { + this.height = eventData.data.height; + } + if(eventData.data.srcValue != null) { + this.srcValue = eventData.data.srcValue; + } + } + } + + private stateChangCallBackTwo = (eventData) => { + if (eventData != null) { + console.info("Background page state change called:" + JSON.stringify(eventData)); + if(eventData.data.backgroundColor != null) { + this.backgroundColor = eventData.data.backgroundColor; + } + if(eventData.data.backgroundImage != null) { + this.backgroundImage = eventData.data.backgroundImage; + } + if(eventData.data.backgroundImageSize != null) { + this.backgroundImageSize = eventData.data.backgroundImageSize; + } + if(eventData.data.backgroundImagePosition != null) { + this.backgroundImagePosition = eventData.data.backgroundImagePosition; + } + } + } + + private stateChangCallBackOne = (eventData) => { + console.info("size page stateChangCallBack" + JSON.stringify(eventData)); + if (eventData) { + this.width = eventData.data.width; + this.height = eventData.data.height; + this.padding = eventData.data.padding; + this.margin = eventData.data.margin; + } + } + + private sizeChangCallBack = (eventData) => { + console.info("size page sizeChangCallBack" + JSON.stringify(eventData)); + if (eventData) { + this.sizeWidth = eventData.data.width; + this.sizeHeight = eventData.data.height; + } + } + + private weightChangCallBack = (eventData) => { + console.info("size page weightChangCallBack" + JSON.stringify(eventData)); + if (eventData) { + this.layoutWeight1 = eventData.data.weight; + } + } + + onPageShow() { + console.info('background page show called'); + var stateChangeEvent = { + eventId: 1, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEventTwo = { + eventId: 2, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo); + + let stateChangeEventOne = { + eventId: 34, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventOne, this.stateChangCallBackOne) + + let sizeChangeEvent = { + eventId: 35, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(sizeChangeEvent, this.sizeChangCallBack) + + let weightChangeEvent = { + eventId: 36, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(weightChangeEvent, this.weightChangCallBack) + } + + build() { + Column({ space: 5 }) { + Text('background color').fontSize(9).width('90%').fontColor(0xFF0000).key("fontColor") + Row().width('90%').height(50).backgroundColor(0xEEEE00).key("backgroundColor").border({ width: 1 }) + Text('background image repeat along X').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row() + .backgroundImage('/images/bg.jpg', ImageRepeat.X) + .backgroundImageSize({ width: '250px', height: '140px' }) + .width('90%') + .height(70) + .border({ width: 1 }) + Text('background image repeat along Y').fontSize(9).width('90%').fontColor(0xFF0000) + Row() + .backgroundImage('/images/bg.jpg', ImageRepeat.Y) + .backgroundImageSize({ width: '500px', height: '120px' }) + .width('90%') + .height(100) + .border({ width: 1 }) + Text('background image size').fontSize(9).width('90%').fontColor(0xFF0000) + Row() + .width('90%').height(150) + .backgroundImage('/images/bg.jpg', ImageRepeat.NoRepeat) + .backgroundImageSize({ width: 1000, height: 500 }) + .border({ width: 1 }) + Text('background fill the box(Cover)').fontSize(9).width('90%').fontColor(0xFF0000) + Row() + .width(200) + .height(50) + .backgroundImage('/images/bg.jpg', ImageRepeat.NoRepeat) + .backgroundImageSize(ImageSize.Cover) + .border({ width: 1 }) + Text('background fill the box(Contain)').fontSize(9).width('90%').fontColor(0xFF0000) + Row() + .width(200) + .height(50) + .backgroundImage('/images/bg.jpg', ImageRepeat.NoRepeat) + .backgroundImageSize(ImageSize.Contain) + .border({ width: 1 }) + Text('background image position').fontSize(9).width('90%').fontColor(0xFF0000) + Row() + .width(100) + .height(50) + .backgroundImage('/images/bg.jpg', ImageRepeat.NoRepeat) + .backgroundImageSize({ width: 1000, height: 560 }) + .backgroundImagePosition({ x: -500, y: -300 }) + .border({ width: 1 }) + + Text('margin and padding:').fontSize(26).fontColor(Color.Black).width('90%') + Row() { + Row() { + Row() + .size({ width: this.sizeWidth, height: this.sizeHeight }) + .backgroundColor(0xAFEEEE) + .key('innerRow') + } + .key('centerRow') + .width(this.width) + .height(this.height) + .padding(this.padding) + .margin(this.margin) + .backgroundColor(0xFDF5E6) + }.backgroundColor(0xFFA500) + + Text('layoutWeight') + .fontSize(26) + .fontColor(Color.Black) + .width('90%') + Row() { + Text('layoutWeight(1)') + .size({ width: '30%', height: 110 }) + .backgroundColor(0xFFEFD5) + .textAlign(TextAlign.Center) + .layoutWeight(this.layoutWeight1) + .fontSize(20) + .key('layoutWeight1') + Text('layoutWeight(2)') + .size({ width: '30%', height: 110 }) + .backgroundColor(0xF5DEB3) + .textAlign(TextAlign.Center) + .layoutWeight(this.layoutWeight2) + .fontSize(20) + .key('layoutWeight2') + Text('no layoutWeight') + .size({ width: '30%', height: 110 }) + .backgroundColor(0xD2B48C) + .textAlign(TextAlign.Center) + .fontSize(20) + }.size({ width: '90%', height: 140 }) + .backgroundColor(0xAFEEEE) + + Text('constraintSize') + .fontSize(26) + .fontColor(Color.Black) + .width('90%') + Row() { + Row() + .constraintSize({minWidth: '10%', maxWidth: '50%', height: 70}) + .backgroundColor(0xFFA500) + Row() + .size({width: '30%', height:70}) + .backgroundColor(0xAFEEEE) + }.size({ width: '90%', height: 140 }) + .backgroundColor(0xAFEEEE) + }.width('100%').height('100%').padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/border.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/border.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/border.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/border.ets index 1914a589cd5b300bdb76d62b6d581264e474af3a..77ed7083cf1a324ab6732a2645e57f064b8656bc 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/border.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/border.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' + +import events_emitter from '@ohos.emitter' @Entry @Component @@ -60,7 +61,7 @@ struct BorderExample { onPageShow() { console.info('border page show called'); var stateChangeEvent = { - eventId: 29, + eventId: 3, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkbox.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkbox.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets index 3aee96e4af8aa2968006ed632798af99430ea399..9cc2006d68dd2983bf913c53b2b7dd7e21db9818 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkbox.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkbox.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -32,7 +33,7 @@ struct CheckboxExample { onPageShow() { console.info('Checkbox page show called'); var stateChangeEvent = { - eventId: 41, + eventId: 76, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) @@ -56,4 +57,4 @@ struct CheckboxExample { }) } } -} \ No newline at end of file +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets index d4ee65ceadaa60aa65cf2a63553c5a49b6cd0f1c..c7041864ad713ad9f60d7a420946a9636e86b4b6 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/checkboxGroup.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -32,7 +33,7 @@ struct CheckboxGroupExample { onPageShow() { console.info('checkboxGroup page show called'); var stateChangeEvent = { - eventId: 42, + eventId: 75, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/colorGradient.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/colorGradient.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/colorGradient.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/colorGradient.ets index b9bbf47ae8b0ace7687d452ef7527824fef3e2a6..0c53cf65db086c8b6aa1c4ec75c169ca0563883d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/colorGradient.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/colorGradient.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; + +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -57,19 +58,19 @@ struct ColorGradientExample { onPageShow() { console.info('[ColorGradient] page show called'); var stateChangeEvent = { - eventId: 31, + eventId: 5, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 32, + eventId: 6, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 33, + eventId: 7, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/edgeEffect.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/edgeEffect.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/edgeEffect.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/edgeEffect.ets index 89290280b5e33dbcbf0762f9ba4adad173f7332c..cf05c94f5993465852b19e81dbae8fdf41f4ccd5 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/edgeEffect.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/edgeEffect.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -63,7 +63,7 @@ struct ListExample { onPageShow() { console.info('edgeEffect page show called'); var stateChangeEvent = { - eventId: 9985, + eventId: 91, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets index 80da6b45b5212ff86a459d04e50062bfa4edc062..df6e373748f2b8103de7f19a58e03339a32d275e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsFlexAlign.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets index 218fb62c3d46a074ba6872351211b5874c9a8506..dfabcf6c3eb988954ebace8fbc93a711e24e271b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsHorizontalAlign.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsImage.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsImage.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsImage.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsImage.ets index 84de880c27e3ccdb1e58c4960f320587dc8ff0f7..c13f5c6b3e30949927fccdf91c4f0e1bef46c08a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsImage.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsImage.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets index d574b433f8f32214fe71d84a3de951bc5e0ae1a6..a1f56de60ff57a7175f08c897e16aad602d7a71e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/enumsVerticalAlign.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fillMode.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/fillMode.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fillMode.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/fillMode.ets index bdcad9499235c3153d60fcdc2a4da5adcf78eabf..031f6c9f5c44329ef954cb5f1c498fd8ed8d89fc 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fillMode.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/fillMode.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' + @Entry @Component struct fillModeExample { @@ -90,7 +91,7 @@ struct fillModeExample { } } var backEvent = { - eventId: 888, + eventId: 94, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") @@ -109,7 +110,7 @@ struct fillModeExample { } } var backEvent = { - eventId: 889, + eventId: 95, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") @@ -128,7 +129,7 @@ struct fillModeExample { } } var backEvent = { - eventId: 890, + eventId: 96, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..a9c75c7154b8b5d6f5f76b1cf05cff275d4386f4 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +// @ts-nocheck +/** + * 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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets index 2a4065dfb7b1c804b15beb5349e039a48f5f5245..43fad49ac0e6ffdfff747f152d78dcf7c4b26b65 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/ohosMatrix4.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' import Matrix4 from '@ohos.matrix4' import prompt from '@system.prompt' @@ -66,7 +66,7 @@ struct ohosMatrix4 { console.info('transFormExample page show called'); var stateChangeEvent = { - eventId: 45, + eventId: 140, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -118,7 +118,7 @@ struct ohosMatrix4 { } } var backEvent = { - eventId: 30, + eventId: 141, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/positionSetting.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets similarity index 91% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/positionSetting.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets index 8a39b1fedceafab4576ed0721fecf150bac4f507..eb04a89b659d3f68c2c00eabbc711d9ee798e7bf 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/positionSetting.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/positionSetting.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct PositionSetting { @@ -23,11 +24,12 @@ struct PositionSetting { @State position2: {x: string, y: string} = {x: '50%', y: '70%'}; @State anchor: {x: string, y: string} = {x: 25, y: 25}; @State offset: {x: string, y: string} = {x: 10, y: 15}; + @State opacityValue: string = 1; build() { Column() { Column({space: 10}) { - Text('align').fontSize(20).fontColor(Color.Black).width('90%') + Text('opacity(1)').fontSize(20).fontColor(Color.Black).width('90%').opacity(`${this.opacityValue}`).key("opacity") Text('top start') .align(this.align) .height(50) @@ -106,31 +108,31 @@ struct PositionSetting { } onPageShow() { let stateChangeEvent = { - eventId: 21, + eventId: 25, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); let directionChangeEvent = { - eventId: 22, + eventId: 26, priority: events_emitter.EventPriority.LOW } events_emitter.on(directionChangeEvent, this.stateChangCallBack); let positionChangeEvent = { - eventId: 23, + eventId: 27, priority: events_emitter.EventPriority.LOW } events_emitter.on(positionChangeEvent, this.stateChangCallBack); let markAnchorChangeEvent = { - eventId: 24, + eventId: 28, priority: events_emitter.EventPriority.LOW } events_emitter.on(markAnchorChangeEvent, this.stateChangCallBack); let offsetChangeEvent = { - eventId: 25, + eventId: 29, priority: events_emitter.EventPriority.LOW } events_emitter.on(offsetChangeEvent, this.stateChangCallBack); @@ -139,7 +141,7 @@ struct PositionSetting { console.info("position page stateChangCallBack" + JSON.stringify(eventData)); if (eventData) { if (eventData.data.textAlign) { - this.align = eventData.data.textAlign; + this.align = Alignment.BottomEnd; } else if (eventData.data.direction) { this.direction = eventData.data.direction; } else if (eventData.data.position1) { @@ -149,6 +151,8 @@ struct PositionSetting { this.anchor = JSON.parse(eventData.data.markAnchor); } else if (eventData.data.offset) { this.offset = JSON.parse(eventData.data.offset); + } else if (eventData.data.opacityValue) { + this.opacityValue = eventData.data.opacityValue; } } } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/select.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/select.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/select.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/select.ets index b58caf3309a6230d8753920a73df3581e2f00111..930b402bd4d969502269d17e6ff9b032321b805c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/select.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/select.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' + @Entry @Component struct SliderExample { @@ -39,7 +40,7 @@ struct SliderExample { onPageShow() { console.info('select page show called'); var stateChangeEvent = { - eventId: 40, + eventId: 191, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -54,7 +55,7 @@ struct SliderExample { .selected(2) .value('TTT') .value(this.value) - .font(this.value) + .font(this.font) .fontColor(this.fontColor) .selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) .optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/shapeClipping.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/shapeClipping.ets similarity index 64% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/shapeClipping.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/shapeClipping.ets index e6723de8d3d496f9963f01aca9860266f49a92ad..0e4cee96640137a5c0368685b0edf9b53455ea73 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/shapeClipping.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/shapeClipping.ets @@ -13,18 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; + +import events_emitter from '@ohos.emitter'; + @Entry @Component struct ClipAndMaskExample { @State isMaskRect: boolean = true; @State isClipCircle:boolean = true; + @State maskType: CommonShapeMethod= new Rect({ width: 280, height: 280 }); + @State clipType: CommonShapeMethod= new Circle({ width: 280, height: 280 }); private stateChangCallBack = (eventData) => { if (eventData != null) { console.info("shapeClipping page state change called:" + JSON.stringify(eventData)); if(eventData.data.maskValue != null) { - this.isMaskReact = eventData.data.maskValue; + this.maskType = new Circle({ width: 280, height: 280 }); } } } @@ -33,7 +37,7 @@ struct ClipAndMaskExample { if (eventData != null) { console.info("shapeClipping page shape change called:" + JSON.stringify(eventData)); if(eventData.data.clipValue != null) { - this.isClipCircle = eventData.data.clipValue; + this.clipType = new Rect({ width: 280, height: 280 }); } } } @@ -41,13 +45,13 @@ struct ClipAndMaskExample { onPageShow() { console.info('shapeClipping page show called'); var stateChangeEvent = { - eventId: 99, + eventId: 32, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var shapeChangeEvent = { - eventId: 98, + eventId: 33, priority: events_emitter.EventPriority.LOW } events_emitter.on(shapeChangeEvent, this.shapeChangCallBack); @@ -60,19 +64,11 @@ struct ClipAndMaskExample { .width('90%') .fontColor(0xCCCCCC) - if (this.isClipCircle) { - Image('/images/clip.png') - .clip(new Circle({ width: 80, height: 80 })) - .width('500px') - .height('280px') - .key('image_clip') - } else { - Image('/images/clip.png') - .clip(new Rect({ width: 80, height: 60 })) - .width('500px') - .height('280px') - .key('image_clip') - } + Image('/images/clip.png') + .clip(this.clipType) + .width('500px') + .height('280px') + .key('image_clip') Row() { Image('/images/clip.png') @@ -88,18 +84,12 @@ struct ClipAndMaskExample { .width('90%') .fontColor(0xCCCCCC) - if (this.isMaskRect) { - Image('/images/clip.png') - .mask(new Rect({ width: '500px', height: '280px' }).fill(Color.Grey)) - .width('500px').height('280px') - .key('image_mask') - } else { - Image('/images/clip.png') - .mask(new Circle({ width: '280px', height: '280px' }).fill(Color.Grey)) - .width('500px').height('280px') - .key('image_mask') - } + Image('/images/clip.png') + .mask(this.maskType) + .width('500px').height('280px') + .key('image_mask') } + .width('100%') .margin({ top: 5 }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/slider.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/slider.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/slider.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/slider.ets index 9ffc4d846f2fb4d3e386f7075a3a6995c22f9519..eecd36e5212c0cdd100225b81ece6ec20145ad0d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/slider.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/slider.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -23,7 +23,7 @@ struct SliderExample { @State outVerticalSetValue: number = 40 @State inVerticalSetValue: number = 40 @State stepValue: number = 1 - @State decorationValue:decoration=Axis.Vertical + @State decorationValue: Axis = Axis.Vertical @State value: number = 40 private stateChangCallBack = (eventData) => { @@ -44,7 +44,7 @@ struct SliderExample { onPageShow() { console.info('slider page show called'); var stateChangeEvent = { - eventId: 50, + eventId: 196, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -82,7 +82,7 @@ struct SliderExample { min: 0, max: 100, step: 1, - style: SliderStyle.InSet + style: SliderStyle.InSet, }) .blockColor(0xCCCCCC) .trackColor(Color.Black) @@ -126,9 +126,9 @@ struct SliderExample { value: this.inVerticalSetValue, min: 0, max: 100, - step: 1, + step: this.stepValue, style: SliderStyle.InSet, - direction: Axis.Vertical + direction: this.decorationValue }) .key('slider') .blockColor(0xCCCCCC) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/transForm.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/transForm.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/transForm.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/transForm.ets index 9d847095d0a89c6a1d47354a83692dd58400592e..ecdec677ffb709f4d6fc405222be23c15912aeb0 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/transForm.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/transForm.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' + +import events_emitter from '@ohos.emitter' import Matrix4 from '@ohos.matrix4' @Entry @@ -46,13 +47,13 @@ struct TransformExample { onPageShow() { console.info('transFormExample page show called'); var stateChangeEvent = { - eventId: 40, + eventId: 45, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent2 = { - eventId: 41, + eventId: 46, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent2, this.stateChangCallBack); diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/visibility.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/visibility.ets new file mode 100755 index 0000000000000000000000000000000000000000..8a80211cd6424979cff0a5563b3f0579e053b2cc --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/pages/visibility.ets @@ -0,0 +1,69 @@ +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct VisibilityExample { + @State visibility: Visibility = Visibility.Visible; + + onPageShow() { + let hiddenChangeEvent = { + eventId: 47, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(hiddenChangeEvent, this.hiddenChangCallBack) + + let noneChangeEvent = { + eventId: 48, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(noneChangeEvent, this.noneChangCallBack) + } + + private hiddenChangCallBack = (eventData) => { + console.info("[hiddenChangCallBack] stateChangCallBack"); + if (eventData != null) { + console.info("[hiddenChangCallBack] state change called:" + JSON.stringify(eventData)); + if(eventData.data.visibility != null) { + this.visibility = eventData.data.visibility; + } + } + } + + private noneChangCallBack = (eventData) => { + console.info("[noneChangCallBack] stateChangCallBack"); + if (eventData != null) { + console.info("[noneChangCallBack] state change called:" + JSON.stringify(eventData)); + if(eventData.data.visibility != null) { + this.visibility = eventData.data.visibility; + } + } + } + + build() { + Column() { + Column() { + Text('BoxOne').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row().visibility(this.visibility).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20).key('box') + + Text('BoxTwo').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE).padding(20) + }.width('90%').border({ width: 1 }) + }.width('100%').margin({ top: 5 }) + } +} diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BackgroundAndSizeSettingJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BackgroundAndSizeSettingJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8e6eb26528e5ab27097bb3bffb060c72386b50e7 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BackgroundAndSizeSettingJsunit.test.ets @@ -0,0 +1,225 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils.ets'; + +export default function backgroundAndSizeSettingJsunit() { + describe('backgroundAndSizeSettingTest', function () { + beforeEach(async function (done) { + console.info("backgroundAndSizeSetting beforeEach start"); + let options = { + uri: 'pages/backgroundAndSizeSetting', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get backgroundAndSizeSetting state success " + JSON.stringify(pages)); + if (!("backgroundAndSizeSetting" == pages.name)) { + console.info("get backgroundAndSizeSetting state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push backgroundAndSizeSetting page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push backgroundAndSizeSetting page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("backgroundAndSizeSetting after each called"); + }); + + it('testBackgroundAndSizeSetting_0100', 0, async function (done) { + console.info('testBackgroundAndSizeSetting_0100 START'); + await Utils.sleep(4000); + let strJson = getInspectorByKey('fontColor'); + console.info("testBackgroundAndSizeSetting_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testBackgroundAndSizeSetting_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontColor).assertEqual("#FFFF0000"); + console.info('testBackgroundAndSizeSetting_0100 END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0200', 0, async function (done) { + console.info('testBackgroundAndSizeSetting_0200 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "color": '0xFF0000' + } + } + var innerEvent = { + eventId: 2, + priority: events_emitter.EventPriority.LOW + } + console.info("testBackgroundAndSizeSetting_0200 start pages"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testBackgroundAndSizeSetting_0200 change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('backgroundColor'); + console.info("testBackgroundAndSizeSetting_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testBackgroundAndSizeSetting_0200 rowDirection: " + obj.$attrs.direction); + expect(obj.$attrs.backgroundColor).assertEqual("#FFEEEE00"); + done(); + }); + + it('testBackgroundAndSizeSetting_0300', 0, async function (done) { + console.info('testBackgroundAndSizeSetting_0300 START'); + await Utils.sleep(4000); + let strJson = getInspectorByKey('backgroundColor'); + console.info("testBackgroundAndSizeSetting_0300 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testBackgroundAndSizeSetting_0300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.borderWidth).assertEqual("1.00vp"); + console.info('testBackgroundAndSizeSetting_0300 END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0400', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0400] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('centerRow'); + console.info("[testBackgroundAndSizeSetting_0400] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.width).assertEqual('80.00vp'); + expect(obj.$attrs.height).assertEqual('80.00vp'); + expect(obj.$attrs.padding).assertEqual('20.00vp'); + expect(obj.$attrs.margin).assertEqual('20.00vp'); + console.info('[testBackgroundAndSizeSetting_0400] END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0500', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0500] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('innerRow'); + console.info("[testBackgroundAndSizeSetting_0500] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.width).assertEqual('100.00%'); + expect(obj.$attrs.height).assertEqual('100.00%'); + console.info('[testBackgroundAndSizeSetting_0500] END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0600', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0600] START'); + try { + let eventData = { + data: { + "width": '200', + "height": '200', + "padding": '10', + "margin": '40' + } + } + let indexEvent = { + eventId: 34, + priority: events_emitter.EventPriority.LOW + } + console.info("[testBackgroundAndSizeSetting_0600] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testBackgroundAndSizeSetting_0600] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('centerRow'); + console.info("[testBackgroundAndSizeSetting_0600] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.width).assertEqual('200.00vp'); + expect(obj.$attrs.height).assertEqual('200.00vp'); + expect(obj.$attrs.padding).assertEqual('10.00vp'); + expect(obj.$attrs.margin).assertEqual('40.00vp'); + console.info('[testBackgroundAndSizeSetting_0600] END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0700', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0700] START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "width": '80%', + "height": '80%' + } + } + let indexEvent = { + eventId: 35, + priority: events_emitter.EventPriority.LOW + } + console.info("[testBackgroundAndSizeSetting_0700] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testBackgroundAndSizeSetting_0700] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('innerRow'); + console.info("[testBackgroundAndSizeSetting_0700] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.width).assertEqual('80.00%'); + expect(obj.$attrs.height).assertEqual('80.00%'); + console.info('[testBackgroundAndSizeSetting_0700] END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0800', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0800] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('layoutWeight1'); + console.info("[testBackgroundAndSizeSetting_0800] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.layoutWeight).assertEqual(1); + console.info('[testBackgroundAndSizeSetting_0800] END'); + done(); + }); + + it('testBackgroundAndSizeSetting_0900', 0, async function (done) { + console.info('[testBackgroundAndSizeSetting_0900] START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "weight": '3' + } + } + let indexEvent = { + eventId: 36, + priority: events_emitter.EventPriority.LOW + } + console.info("[testBackgroundAndSizeSetting_0900] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testBackgroundAndSizeSetting_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('layoutWeight1'); + console.info("[testBackgroundAndSizeSetting_0900] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.layoutWeight).assertEqual(3); + console.info('[testBackgroundAndSizeSetting_0900] END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BorderJsunit.test.ets similarity index 90% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BorderJsunit.test.ets index 37e214dd96ba88d7e126675741ef2dafb17c368b..bbfd38439967bd9067804891c8d35f0037f6f8b7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/BorderJsunit.test.ets @@ -16,14 +16,14 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' -import Utils from '../Utils.ets'; +import Utils from './Utils.ets'; export default function borderJsunit() { describe('borderTest', function () { beforeEach(async function (done) { console.info("border beforeEach start"); let options = { - uri: 'pages/general-properties/border', + uri: 'pages/border', } try { router.clear(); @@ -53,7 +53,7 @@ export default function borderJsunit() { console.info("testBorder_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("testBorder_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderWidth).assertEqual("5.000000vp"); + expect(obj.$attrs.borderWidth).assertEqual("5.00vp"); console.info('testBorder_0100 END'); done(); }); @@ -72,7 +72,7 @@ export default function borderJsunit() { it('testBorder_0300', 0, async function (done) { console.info('testBorder_0300 START'); - await Utils.sleep(2000); + await Utils.sleep(1000); try { var eventData = { data: { @@ -80,7 +80,7 @@ export default function borderJsunit() { } } var innerEvent = { - eventId: 29, + eventId: 3, priority: events_emitter.EventPriority.LOW } console.info("[testBorder_0300] start to publish emit"); @@ -88,12 +88,12 @@ export default function borderJsunit() { } catch (err) { console.log("[testBorder_0300] change component data error: " + err.message); } - await Utils.sleep(3000); + await Utils.sleep(2000); let strJson = getInspectorByKey('borderRadius'); console.info("testBorder_0300 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("testBorder_0300 component obj is: " + obj.$attrs.borderRadius); - expect(obj.$attrs.borderRadius).assertEqual("70.000000vp"); + expect(obj.$attrs.borderRadius).assertEqual("70.00vp"); console.info('testBorder_0300 END'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets index 4eba631650bc883c5cdb22f51cc2f83050054931..44ba3b8ab3eaab40a6505aa2a4a3501459c9d39f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxGroupJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; export default function checkboxGroupJsunit() { describe('checkboxGroupTest', function () { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets similarity index 73% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets index 037a86b66d1489bbfc3a40c04c5eb292cbfb08dc..776fff2dd7a2cb1e4a703342ac3018c63e49fca4 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/CheckboxJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +16,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; export default function checkboxJsunit() { describe('checkboxTest', function () { @@ -45,23 +45,12 @@ export default function checkboxJsunit() { }); it('testCheckbox_100', 0, async function (done) { - console.info('testCheckbox_100 START'); + console.info('[testCheckbox_100] START'); await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("testCheckbox_100 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(false); - } - let indexEvent = { - eventId: 41, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testCheckbox_100 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testCheckbox_100 click result is: " + JSON.stringify(sendEventByKey('Checkbox1',10,""))); - await Utils.sleep(2000); + let strJson = getInspectorByKey('Checkbox1'); + let obj = JSON.parse(strJson); + console.info("testCheckbox_100 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.grayscale).assertEqual(0); console.info('testCheckbox_100 END'); done(); }); @@ -72,7 +61,7 @@ export default function checkboxJsunit() { let strJson = getInspectorByKey('Checkbox1'); let obj = JSON.parse(strJson); console.info("testCheckbox_200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.grayscale).assertEqual(0); + expect(obj.$attrs.opacity).assertEqual(1); console.info('testCheckbox_200 END'); done(); }); @@ -83,7 +72,7 @@ export default function checkboxJsunit() { let strJson = getInspectorByKey('Checkbox1'); let obj = JSON.parse(strJson); console.info("testCheckbox_300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.opacity).assertEqual(1); + expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); console.info('testCheckbox_300 END'); done(); }); @@ -94,19 +83,8 @@ export default function checkboxJsunit() { let strJson = getInspectorByKey('Checkbox1'); let obj = JSON.parse(strJson); console.info("testCheckbox_400 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); - console.info('testCheckbox_400 END'); - done(); - }); - - it('testCheckbox_500', 0, async function (done) { - console.info('[testCheckbox_500] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('Checkbox'); - let obj = JSON.parse(strJson); - console.info("testCheckbox_500 component obj is: " + JSON.stringify(obj)); expect(obj.$attrs.visibility).assertEqual("Visibility.Visible"); - console.info('testCheckbox_500 END'); + console.info('testCheckbox_400 END'); done(); }); }) diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ColorGradientJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ColorGradientJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..818be8a351c9e8d185189b73a086cec817a3a23d --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ColorGradientJsunit.test.ets @@ -0,0 +1,198 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function colorGradientJsunit() { + describe('borderTest', function () { + beforeEach(async function (done) { + console.info("colorGradient beforeEach start"); + let options = { + uri: 'pages/colorGradient', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get colorGradient state pages:" + JSON.stringify(pages)); + if (!("colorGradient" == pages.name)) { + console.info("get colorGradient state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push colorGradient page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push colorGradient page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("colorGradient after each called"); + }); + + it('testColorGradient001', 0, async function (done) { + console.info('[testColorGradient001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('linearGradient'); + let obj = JSON.parse(strJson); + console.info("[testColorGradient001] component obj is: " + JSON.stringify(obj.$attrs.linearGradient)); + expect(obj.$attrs.linearGradient.angle).assertEqual('90.00px'); + expect(obj.$attrs.linearGradient.direction).assertEqual('GradientDirection.Left'); + expect(obj.$attrs.linearGradient.repeating).assertEqual('true'); + console.info('[testColorGradient001] END'); + done(); + }); + + it('testColorGradient002', 0, async function (done) { + console.info('[testColorGradient002] START'); + await Utils.sleep(1000); + let linearGradientValue = { + angle: 80, + direction: GradientDirection.Top, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], + repeating: false + }; + try { + var eventData = { + data: { + "linearGradientValue": JSON.stringify(linearGradientValue) + } + } + var innerEvent = { + eventId: 5, + priority: events_emitter.EventPriority.LOW + } + console.info("[testColorGradient002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testColorGradient002] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('linearGradient'); + let objNew = JSON.parse(strJsonNew); + console.info("[testColorGradient002] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.linearGradient.angle).assertEqual('80.00px'); + expect(objNew.$attrs.linearGradient.direction).assertEqual('GradientDirection.Top'); + expect(objNew.$attrs.linearGradient.repeating).assertEqual('false'); + console.info('[testColorGradient002] END'); + done(); + }); + + it('testColorGradient003', 0, async function (done) { + await Utils.sleep(1000) + console.info('[testColorGradient003] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('sweepGradient'); + let obj = JSON.parse(strJson); + console.info("[testColorGradient003] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.sweepGradient.end).assertEqual('359.00px'); + expect(obj.$attrs.sweepGradient.start).assertEqual('0.00px'); + expect(obj.$attrs.sweepGradient.repeating).assertEqual('true'); + console.info('[testColorGradient003] END'); + done(); + }); + + it('testColorGradient004', 0, async function (done) { + console.info('[testColorGradient004] START'); + await Utils.sleep(1000); + let sweepGradientValue = { + center: [50, 50], + start: 10, + end: 356, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], + repeating: false + }; + try { + var eventData = { + data: { + "sweepGradientValue": JSON.stringify(sweepGradientValue) + } + } + var innerEvent = { + eventId: 6, + priority: events_emitter.EventPriority.LOW + } + console.info("[testColorGradient004] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testColorGradient004] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('sweepGradient'); + let objNew = JSON.parse(strJsonNew); + console.info("[testColorGradient004] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.sweepGradient.end).assertEqual('356.00px'); + expect(objNew.$attrs.sweepGradient.start).assertEqual('10.00px'); + expect(objNew.$attrs.sweepGradient.repeating).assertEqual('false'); + console.info('[testColorGradient004] END'); + done(); + }); + + it('testColorGradient005', 0, async function (done) { + await Utils.sleep(1000) + console.info('[testColorGradient005] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('radialGradient'); + let obj = JSON.parse(strJson); + console.info("[testColorGradient005] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.radialGradient.radius).assertEqual('60.00vp'); + expect(obj.$attrs.radialGradient.center[0]).assertEqual('50.00vp'); + expect(obj.$attrs.radialGradient.center[1]).assertEqual('50.00vp'); + expect(obj.$attrs.radialGradient.repeating).assertEqual('true'); + console.info('[testColorGradient005] END'); + done(); + }); + + it('testColorGradient006', 0, async function (done) { + console.info('[testColorGradient006] START'); + await Utils.sleep(1000); + let radialGradientValue = { + center: [60, 60], + radius: 70, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]], + repeating: false + }; + try { + var eventData = { + data: { + "radialGradientValue": JSON.stringify(radialGradientValue) + } + } + var innerEvent = { + eventId: 7, + priority: events_emitter.EventPriority.LOW + } + console.info("[testColorGradient006] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testColorGradient006] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('radialGradient'); + let objNew = JSON.parse(strJsonNew); + console.info("[testColorGradient006] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.radialGradient.radius).assertEqual('70.00vp'); + expect(objNew.$attrs.radialGradient.center[0]).assertEqual('60.00vp'); + expect(objNew.$attrs.radialGradient.center[1]).assertEqual('60.00vp'); + expect(objNew.$attrs.radialGradient.repeating).assertEqual('false'); + console.info('[testColorGradient006] END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets index 9917a405857ed249160ffc6fdd1cde082a7956c8..f08051df99cd26c7debbfc6367ca839e5c280b06 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EdgeEffectJsunit.test.ets @@ -16,7 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; -//import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.events.emitter'; export default function edgeEffectJsunit(){ describe('edgeEffectTest', function (){ @@ -64,7 +64,7 @@ export default function edgeEffectJsunit(){ } } let indexEvent = { - eventId: 9985, + eventId: 91, priority: events_emitter.EventPriority.LOW } console.info("edgeEffectTest_0200 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets index 7fa1c710d57686a5e50c5c4bdaff40aed9d835ac..310464b7860697c2f040ff5681bb0d3f863da606 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusFlexAlignJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsFlexItemJsunit() { @@ -56,6 +55,5 @@ export default function enumsFlexItemJsunit() { console.info('enumsFlexItemTest_0100 END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets index 0c98253ffad3145d94e64cd751e20c19465c9f98..c9b40488e062d8ce4dfe9db0beab633cd9a830cd 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusHorizontalAlignJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsVerticalAlignJsunit() { @@ -57,6 +56,5 @@ export default function enumsVerticalAlignJsunit() { console.info('enumsHorizontalAlignTest_0100 END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets index 19a9921fe5c09107093dd37b7492195c1d03b33b..73ec341b8df6b451bc06f99a3b2b1b302b1cdabd 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusImageJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsImageJsunit() { @@ -56,6 +55,7 @@ export default function enumsImageJsunit() { console.info('enumsImageTest_0100 END'); done(); }); + it('enumsImageTest_0200', 0, async function (done) { console.info('enumsImageTest_0200 START'); let strJson = getInspectorByKey('Image'); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets index c469251c4280dc7a59c86bdd453ccb16b0e84cd8..3707c0fb362cb5d9f17c799783ea2fd1ccdb4235 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/EnmusVerticalAlignJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsVerticalAlignJsunit() { @@ -29,7 +28,7 @@ export default function enumsVerticalAlignJsunit() { router.clear(); let pages = router.getState(); console.info('beforeEach get enumsVerticalAlign state pages:' + JSON.stringify(pages)); - if (!('enumsFlexItem' == pages.name)) { + if (!('enumsVerticalAlign' == pages.name)) { console.info('beforeEach get enumsVerticalAlign state pages.name:' + JSON.stringify(pages.name)); let result = await router.push(options); await Utils.sleep(2000); @@ -52,11 +51,10 @@ export default function enumsVerticalAlignJsunit() { let strJson = getInspectorByKey('VerticalAlign'); console.info("enumsVerticalAlignTest_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); - console.info("enumsVerticalAlignTest_0100 component obj is: " + JSON.stringify(obj)); + console.info("enumsVerticalAlignTest_0100 component obj is: " + JSON.stringify(obj.$attrs.alignItems)); expect(obj.$attrs.alignItems).assertEqual('VerticalAlign.Center'); console.info('enumsVerticalAlignTest_0100 END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets index 3805b01d0e4812a42057f1d5693230e3e46c81f0..879799eec151f0ba776ef02a1bad8aa479c2ea9b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/FillModeJsunit.test.ets @@ -54,7 +54,7 @@ export default function fillModeJsunit(){ expect(indexEvent.data.fillMode).assertEqual(FillMode.Backwards); } let indexEvent = { - eventId: 888, + eventId: 94, priority: events_emitter.EventPriority.LOW } try { @@ -76,7 +76,7 @@ export default function fillModeJsunit(){ expect(indexEvent.data.fillMode).assertEqual(FillMode.Both); } let indexEvent = { - eventId: 889, + eventId: 95, priority: events_emitter.EventPriority.LOW } try { @@ -98,7 +98,7 @@ export default function fillModeJsunit(){ expect(indexEvent.data.fillMode).assertEqual(FillMode.None); } let indexEvent = { - eventId: 890, + eventId: 96, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0cb18e02737f14f1c91e9b511ea8df1336396ec3 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,53 @@ +/** + * 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 checkboxJsunit from './CheckboxJsunit.test.ets'; +import ohosMatrix4Jsunit from './OhosMatrix4Jsunit.test.ets'; +import selectJsunit from './SelectJsunit.test.ets'; +import fillModeJsunit from './FillModeJsunit.test.ets'; +import enumsImageJsunit from './EnmusImageJsunit.test.ets'; +import checkboxGroupJsunit from './CheckboxGroupJsunit.test.ets'; +import sliderJsunit from './SliderJsunit.test.ets'; +import edgeEffectJsunit from './EdgeEffectJsunit.test.ets'; +import transFormJsunit from './TransFormJsunit.test.ets'; +import visibilityJsunit from './VisibilityJsunit.test.ets'; +import positionSettingJsunit from './PositionSettingJsunit.test.ets'; +import shapeClippingJsunit from './ShapeClippingJsunit.test.ets'; +import backgroundAndSizeSettingJsunit from './BackgroundAndSizeSettingJsunit.test.ets'; +import borderJsunit from './BorderJsunit.test.ets'; +import colorGradientJsunit from './ColorGradientJsunit.test.ets'; +import enmusFlexAlignJsunit from './EnmusFlexAlignJsunit.test.ets'; +import enmusVerticalAlignJsunit from './EnmusVerticalAlignJsunit.test.ets'; +import enmusHorizontalAlignJsunit from './EnmusHorizontalAlignJsunit.test.ets'; + +export default function testsuite() { + checkboxJsunit(); + selectJsunit(); + fillModeJsunit(); + enumsImageJsunit(); + ohosMatrix4Jsunit(); + sliderJsunit(); + edgeEffectJsunit(); + checkboxGroupJsunit(); + transFormJsunit(); + borderJsunit(); + colorGradientJsunit(); + visibilityJsunit(); + positionSettingJsunit(); + backgroundAndSizeSettingJsunit(); + shapeClippingJsunit(); + enmusHorizontalAlignJsunit(); + enmusFlexAlignJsunit(); + enmusVerticalAlignJsunit(); +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets index 986fda33b1a9181e13eea1da748e8722da77d128..10d4d5ce645d35aeec65b953742e9a3c1bc534b7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/OhosMatrix4Jsunit.test.ets @@ -101,7 +101,7 @@ export default function ohosMatrix4Jsunit() { } } var innerEvent = { - eventId: 41, + eventId: 140, priority: events_emitter.EventPriority.LOW } console.info("[test_OhosMatrix4_004] start to publish emit"); @@ -125,7 +125,7 @@ export default function ohosMatrix4Jsunit() { expect(eventData.data.matrix1).assertEqual("[100, 10]") } var innerEvent = { - eventId: 30, + eventId: 141, priority: events_emitter.EventPriority.LOW } try { @@ -156,7 +156,7 @@ export default function ohosMatrix4Jsunit() { } } var innerEvent = { - eventId: 45, + eventId: 140, priority: events_emitter.EventPriority.LOW } console.info("[test_OhosMatrix4_006] start to publish emit"); diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/PositionSettingJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/PositionSettingJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8b1f3b1336d4019e7bcea8ecf09c8908263183b1 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/PositionSettingJsunit.test.ets @@ -0,0 +1,315 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function positionSettingJsunit() { + describe('borderTest', function () { + beforeEach(async function (done) { + console.info("positionSetting beforeEach start"); + let options = { + uri: 'pages/positionSetting', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get positionSetting state pages:" + JSON.stringify(pages)); + if (!("positionSetting" == pages.name)) { + console.info("get positionSetting state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push positionSetting page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push positionSetting page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("positionSetting after each called"); + }); + + it('testPositionSetting001', 0, async function (done) { + console.info('[testPositionSetting001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textAlign'); + console.info("[testPositionSetting001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting001] textAlign: " + obj.$attrs.textAlign); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + console.info('[testPositionSetting001] END'); + done(); + }); + + it('testPositionSetting002', 0, async function (done) { + console.info('[testPositionSetting002] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('rowDirection'); + console.info("[testPositionSetting002] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting002] rowDirection: " + obj.$attrs.direction); + expect(obj.$attrs.direction).assertEqual('Direction.Rtl'); + console.info('[testPositionSetting002] END'); + done(); + }); + + it('testPositionSetting003', 0, async function (done) { + console.info('[testPositionSetting003] START'); + try { + let eventData = { + data: { + "textAlign": Alignment.BottomEnd + } + } + let indexEvent = { + eventId: 25, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting003] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testPositionSetting003] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('textAlign'); + console.info("[testPositionSetting003] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting003] textAlign: " + obj.$attrs.textAlign); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Start"); + console.info('[testPositionSetting003] END'); + done(); + }); + + it('testPositionSetting004', 0, async function (done) { + console.info('[testPositionSetting004] START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "direction": Direction.Ltr + } + } + let indexEvent = { + eventId: 26, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting004] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testPositionSetting004] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('rowDirection'); + console.info("[testPositionSetting004] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting004] rowDirection: " + obj.$attrs.direction); + expect(obj.$attrs.direction).assertEqual('Direction.Ltr'); + console.info('[testPositionSetting004] END'); + done(); + }); + + it('testPositionSetting005', 0, async function (done) { + console.info('[testPositionSetting005] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('position1'); + console.info("[testPositionSetting005] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting005] position: " + JSON.stringify(obj.$attrs.position)); + expect(obj.$attrs.position.x).assertEqual('25.00vp'); + expect(obj.$attrs.position.y).assertEqual('15.00vp'); + let strJson1 = getInspectorByKey('position2'); + console.info("[testPositionSetting005] component strJson1:" + strJson1); + let obj1 = JSON.parse(strJson1); + console.info("[testPositionSetting005] position1: " + JSON.stringify(obj1.$attrs.position)); + expect(obj1.$attrs.position.x).assertEqual('50.00%'); + expect(obj1.$attrs.position.y).assertEqual('70.00%'); + console.info('[testPositionSetting005] END'); + done(); + }); + + it('testPositionSetting006', 0, async function (done) { + console.info('[testPositionSetting006] START'); + await Utils.sleep(1000); + try { + let data = { + x: 10, y: 25 + }; + let data2 = { + x: '30%', y: '50%' + }; + let eventData = { + data: { + "position1": JSON.stringify(data), + "position2": JSON.stringify(data2) + } + } + let indexEvent = { + eventId: 27, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting006] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testPositionSetting006] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('position1'); + console.info("[testPositionSetting006] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting006] position1: " + JSON.stringify(obj.$attrs.position)); + expect(obj.$attrs.position.x).assertEqual('10.00vp'); + expect(obj.$attrs.position.y).assertEqual('25.00vp'); + let strJson2 = getInspectorByKey('position2'); + console.info("[testPositionSetting006] component strJson2:" + strJson2); + let obj2 = JSON.parse(strJson2); + console.info("[testPositionSetting006] position2: " + JSON.stringify(obj2.$attrs.position)); + expect(obj2.$attrs.position.x).assertEqual('30.00%'); + expect(obj2.$attrs.position.y).assertEqual('50.00%'); + done(); + }); + + it('testPositionSetting007', 0, async function (done) { + console.info('[testPositionSetting007] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('markAnchor'); + console.info("[testPositionSetting007] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting007] position: " + JSON.stringify(obj.$attrs.markAnchor)); + expect(obj.$attrs.markAnchor.x).assertEqual('25.00vp'); + expect(obj.$attrs.markAnchor.y).assertEqual('25.00vp'); + console.info('[testPositionSetting007] END'); + done(); + }); + + it('testPositionSetting008', 0, async function (done) { + console.info('[testPositionSetting008] START'); + await Utils.sleep(1000); + try { + let data = { + x: 0, y: 0 + }; + let eventData = { + data: { + "markAnchor": JSON.stringify(data), + } + } + let indexEvent = { + eventId: 28, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting008] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testPositionSetting008] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('markAnchor'); + console.info("[testPositionSetting008] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting008] markAnchor: " + JSON.stringify(obj.$attrs.markAnchor)); + expect(obj.$attrs.markAnchor.x).assertEqual('0.00vp'); + expect(obj.$attrs.markAnchor.y).assertEqual('0.00vp'); + console.info('[testPositionSetting008] END'); + done(); + }); + + it('testPositionSetting009', 0, async function (done) { + console.info('[testPositionSetting009] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('offset'); + console.info("[testPositionSetting009] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting009] offset: " + JSON.stringify(obj.$attrs.offset)); + expect(obj.$attrs.offset.x).assertEqual('10.00vp'); + expect(obj.$attrs.offset.y).assertEqual('15.00vp'); + console.info('[testPositionSetting009] END'); + done(); + }); + + it('testPositionSetting010', 0, async function (done) { + console.info('[testPositionSetting010] START'); + await Utils.sleep(1000); + try { + let data = { + x: 150, y: 10 + }; + let eventData = { + data: { + "offset": JSON.stringify(data), + } + } + let indexEvent = { + eventId: 29, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting010] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testPositionSetting010] change component data error: " + err.message); + } + await Utils.sleep(3000); + let strJson = getInspectorByKey('offset'); + console.info("[testPositionSetting010] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting010] offset: " + JSON.stringify(obj.$attrs.offset)); + expect(obj.$attrs.offset.x).assertEqual('150.00vp'); + expect(obj.$attrs.offset.y).assertEqual('10.00vp'); + console.info('[testPositionSetting010] END'); + done(); + }); + + it('testPositionSetting011', 0, async function (done) { + console.info('[testPositionSetting011] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('opacity'); + let obj = JSON.parse(strJson); + console.info("[testPositionSetting011] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.opacity).assertEqual(1); + console.info('[testPositionSetting011] END'); + done(); + }); + + it('testPositionSetting012', 0, async function (done) { + console.info('[testPositionSetting012] START'); + try { + var eventData = { + data: { + "opacityValue": "0.7" + } + } + var innerEvent = { + eventId: 25, + priority: events_emitter.EventPriority.LOW + } + console.info("[testPositionSetting012] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testPositionSetting012] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('opacity'); + let objNew = JSON.parse(strJsonNew); + console.info("[testPositionSetting012] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.opacity).assertEqual(0.7); + console.info('[testPositionSetting012] END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets similarity index 54% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets index 6a55622e37d1ab713f9adff8352668f891ac0229..5a8ce155899653055f999b55f4d07739af078e13 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SelectJsunit.test.ets @@ -66,7 +66,7 @@ export default function selectJsunit() { } } var innerEvent = { - eventId: 40, + eventId: 191, priority: events_emitter.EventPriority.LOW } console.info("[selectTest_0200] start to publish emit"); @@ -89,17 +89,20 @@ export default function selectJsunit() { console.info("[selectTest_0300] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[selectTest_0300] font:" + obj.$attrs.font); - expect(obj.$attrs.font.size).assertEqual('24.00vp'); - expect(obj.$attrs.font.weight).assertEqual('500'); - expect(obj.$attrs.font.family).assertEqual('sans-serif'); - expect(obj.$attrs.font.style).assertEqual('FontStyle.Normal'); + let fontObject = JSON.parse(obj.$attrs.font); + expect(fontObject.size).assertEqual('30.00fp'); + expect(fontObject.weight).assertEqual('400'); + expect(fontObject.family).assertEqual('serif'); + expect(fontObject.style).assertEqual('FontStyle.Normal'); done(); }); it('selectTest_0400', 0, async function (done) { console.info('[selectTest_0400] START'); await Utils.sleep(1000); - let font = {size: 30, weight:400, family: 'serif', style: FontStyle.Normal }; + let font = { + size: 24, weight: 500, family: 'sans-serif', style: FontStyle.Normal + }; try { var eventData = { data: { @@ -107,7 +110,7 @@ export default function selectJsunit() { } } var innerEvent = { - eventId: 40, + eventId: 191, priority: events_emitter.EventPriority.LOW } console.info("[selectTest_0400] start to publish emit"); @@ -120,10 +123,11 @@ export default function selectJsunit() { console.info("[selectTest_0400] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[selectTest_0400] font:" + obj.$attrs.font); - expect(obj.$attrs.font.size).assertEqual('20.00vp'); - expect(obj.$attrs.font.weight).assertEqual('50'); - expect(obj.$attrs.font.family).assertEqual('sans-serif'); - expect(obj.$attrs.font.style).assertEqual('FontStyle.Normal'); + let fontObject = JSON.parse(obj.$attrs.font); + expect(fontObject.size).assertEqual('24.00fp'); + expect(fontObject.weight).assertEqual('500'); + expect(fontObject.family).assertEqual('sans-serif'); + expect(fontObject.style).assertEqual('FontStyle.Normal'); done(); }); @@ -147,7 +151,7 @@ export default function selectJsunit() { } } let indexEvent = { - eventId: 40, + eventId: 191, priority: events_emitter.EventPriority.LOW } console.info("[selectTest_0600] start to publish emit"); @@ -163,5 +167,110 @@ export default function selectJsunit() { expect(obj.$attrs.fontColor).assertEqual('#FF000990'); done(); }); + + it('selectTest_0700', 0, async function (done) { + console.info('[selectTest_0700] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "value": "-10" + } + } + var innerEvent = { + eventId: 191, + priority: events_emitter.EventPriority.LOW + } + console.info("[selectTest_0700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[selectTest_0700] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('select'); + let objNew = JSON.parse(strJsonNew); + console.info("[selectTest_0700] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.value).assertEqual('-10'); + done(); + }); + + it('selectTest_0800', 0, async function (done) { + console.info('[selectTest_0800] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "value": '1111111111' + } + } + var innerEvent = { + eventId: 191, + priority: events_emitter.EventPriority.LOW + } + console.info("[selectTest_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[selectTest_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('select'); + let objNew = JSON.parse(strJsonNew); + console.info("[selectTest_0800] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.value).assertEqual('1111111111'); + done(); + }); + + it('selectTest_0900', 0, async function (done) { + console.info('[selectTest_0900] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "value": '1111111111aaa' + } + } + var innerEvent = { + eventId: 191, + priority: events_emitter.EventPriority.LOW + } + console.info("[selectTest_0900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[selectTest_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('select'); + let objNew = JSON.parse(strJsonNew); + console.info("[selectTest_0900] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.value).assertEqual('1111111111aaa'); + done(); + }); + + it('selectTest_1000', 0, async function (done) { + console.info('[selectTest_1000] START'); + try { + let eventData = { + data: { + "fontColor": 121111 + } + } + let indexEvent = { + eventId: 191, + priority: events_emitter.EventPriority.LOW + } + console.info("[selectTest_1000] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[selectTest_1000] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('select'); + console.info("[selectTest_1000] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[selectTest_1000] fontColor:" + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#FF01D917'); + done(); + }); + }) } diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ShapeClippingJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ShapeClippingJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a6d0db4b6864f0362832d9f520cc910a993f35c2 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/ShapeClippingJsunit.test.ets @@ -0,0 +1,130 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function shapeClippingJsunit() { + describe('borderTest', function () { + beforeEach(async function (done) { + console.info("shapeClipping beforeEach start"); + let options = { + uri: 'pages/shapeClipping', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get shapeClipping state pages:" + JSON.stringify(pages)); + if (!("shapeClipping" == pages.name)) { + console.info("get shapeClipping state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push shapeClipping page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push shapeClipping page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("shapeClipping after each called"); + }); + + it('testShapeClipping001', 0, async function (done) { + console.info('[testShapeClipping001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('image_clip'); + let obj = JSON.parse(strJson); + console.info("[testShapeClipping001] component obj is: " + JSON.stringify(obj)); + let clip = JSON.parse(obj.$attrs.clip); + expect(clip.shape).assertEqual('Circle'); + let strJson1 = getInspectorByKey('image_clip_true'); + let obj1 = JSON.parse(strJson1); + console.info("[testShapeClipping001] component obj1 is: " + JSON.stringify(obj1)); + expect(obj1.$attrs.clip).assertEqual('true'); + console.info('[testShapeClipping001] END'); + done(); + }); + + it('testShapeClipping002', 0, async function (done) { + console.info('[testShapeClipping002] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('image_mask'); + let obj = JSON.parse(strJson); + console.info("[testShapeClipping002] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.mask.shape).assertEqual('Rect'); + expect(obj.$attrs.clip).assertEqual('false'); + console.info('[testShapeClipping002] END'); + done(); + }); + + it('testShapeClipping003', 0, async function (done) { + console.info('[testShapeClipping003] START'); + try { + var eventData = { + data: { + "maskValue": false + } + } + var innerEvent = { + eventId: 32, + priority: events_emitter.EventPriority.LOW + } + console.info("[testShapeClipping003] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testShapeClipping003] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('image_mask'); + let objNew = JSON.parse(strJsonNew); + console.info("[testShapeClipping003] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.mask.shape).assertEqual('Circle'); + console.info('[testShapeClipping003] END'); + done(); + }); + + it('testShapeClipping004', 0, async function (done) { + console.info('[testShapeClipping004] START'); + try { + var eventData = { + data: { + "clipValue": false + } + } + var innerEvent = { + eventId: 33, + priority: events_emitter.EventPriority.LOW + } + console.info("[testShapeClipping004] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testShapeClipping004] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('image_clip'); + let objNew = JSON.parse(strJsonNew); + console.info("[testShapeClipping004] component objNew is: " + JSON.stringify(objNew)); + let clip = JSON.parse(objNew.$attrs.clip); + expect(clip.shape).assertEqual('Rect'); + console.info('[testShapeClipping004] END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/sliderJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SliderJsunit.test.ets similarity index 88% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/sliderJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SliderJsunit.test.ets index 52f990c615adb205719186a0fad7a0991c0f27f2..321d2b3a8741fc99743d092e50384374cfbcb691 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/sliderJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/SliderJsunit.test.ets @@ -51,8 +51,8 @@ export default function sliderJsunit() { let strJson = getInspectorByKey('slider'); console.info("[testSlider001] component strJson:" + strJson); let obj = JSON.parse(strJson); - console.info("[testSlider001] decoration:" + obj.$attrs.decoration); - expect(obj.$attrs.decoration).assertEqual('Axis.Vertical'); + console.info("[testSlider001] decoration:" + JSON.stringify(obj.$attrs)); + expect(obj.$attrs.decoration).assertEqual(undefined); done(); }); @@ -65,7 +65,7 @@ export default function sliderJsunit() { } } let indexEvent = { - eventId: 50, + eventId: 196, priority: events_emitter.EventPriority.LOW } console.info("[testSlider002] start to publish emit"); @@ -78,7 +78,7 @@ export default function sliderJsunit() { console.info("[testSlider002] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSlider002] decoration:" + obj.$attrs.decoration); - expect(obj.$attrs.decorationValue).assertEqual('Axis.Horizontal'); + expect(obj.$attrs.decoration).assertEqual(undefined); done(); }); @@ -88,7 +88,7 @@ export default function sliderJsunit() { let strJson = getInspectorByKey('slider'); console.info("[testSlider003] component strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$attrs.value).assertEqual('40'); + expect(obj.$attrs.value).assertEqual(undefined); done(); }); @@ -102,7 +102,7 @@ export default function sliderJsunit() { } } var innerEvent = { - eventId: 1, + eventId: 196, priority: events_emitter.EventPriority.LOW } console.info("[testSlider004] start to publish emit"); @@ -114,7 +114,7 @@ export default function sliderJsunit() { let strJsonNew = getInspectorByKey('slider'); let objNew = JSON.parse(strJsonNew); console.info("[testSlider004] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.value).assertEqual('10.000000vp'); + expect(objNew.$attrs.value).assertEqual(undefined); done(); }); @@ -124,7 +124,7 @@ export default function sliderJsunit() { console.info("testSlider005 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("testSlider005 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.step).assertEqual('1'); + expect(obj.$attrs.step).assertEqual(undefined); console.info('testSlider005 END'); done(); }); @@ -138,7 +138,7 @@ export default function sliderJsunit() { } } let indexEvent = { - eventId: 50, + eventId: 196, priority: events_emitter.EventPriority.LOW } console.info("testSlider006 start to publish emit"); @@ -150,7 +150,7 @@ export default function sliderJsunit() { let strJsonNew = getInspectorByKey('slider'); let objNew = JSON.parse(strJsonNew); console.info("testSlider006 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.stepValue).assertEqual('10.000000vp'); + expect(objNew.$attrs.step).assertEqual(undefined); console.info('testSlider006 END'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/TransFormJsunit.test.ets similarity index 90% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets rename to ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/TransFormJsunit.test.ets index 5b798e1b8b4843682c480b465bdf5d7a147f4f03..68266f641972691faa7a09df3062e09e86165a55 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/TransFormJsunit.test.ets @@ -16,14 +16,13 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils'; - +import Utils from './Utils'; export default function transFormJsunit() { describe('appInfoTest', function () { beforeEach(async function (done) { console.info("transForm beforeEach start"); let options = { - uri: 'pages/general-properties/transForm', + uri: 'pages/transForm', } try { router.clear(); @@ -56,8 +55,8 @@ export default function transFormJsunit() { expect(obj.$attrs.rotate.x).assertEqual('1.000000'); expect(obj.$attrs.rotate.y).assertEqual('1.000000'); expect(obj.$attrs.rotate.z).assertEqual('1.000000'); - expect(obj.$attrs.rotate.centerX).assertEqual('50.000000%'); - expect(obj.$attrs.rotate.centerY).assertEqual('50.000000%'); + expect(obj.$attrs.rotate.centerX).assertEqual('50.00%'); + expect(obj.$attrs.rotate.centerY).assertEqual('50.00%'); expect(obj.$attrs.rotate.angle).assertEqual('300.000000'); done(); }); @@ -73,7 +72,7 @@ export default function transFormJsunit() { } } var innerEvent = { - eventId: 40, + eventId: 45, priority: events_emitter.EventPriority.LOW } console.info("[testTransForm002] start to publish emit"); @@ -88,8 +87,8 @@ export default function transFormJsunit() { expect(objNew.$attrs.rotate.x).assertEqual('2.000000'); expect(objNew.$attrs.rotate.y).assertEqual('2.000000'); expect(objNew.$attrs.rotate.z).assertEqual('2.000000'); - expect(objNew.$attrs.rotate.centerX).assertEqual('60.000000%'); - expect(objNew.$attrs.rotate.centerY).assertEqual('60.000000%'); + expect(objNew.$attrs.rotate.centerX).assertEqual('60.00%'); + expect(objNew.$attrs.rotate.centerY).assertEqual('60.00%'); expect(objNew.$attrs.rotate.angle).assertEqual('100.000000'); done(); }); @@ -116,7 +115,7 @@ export default function transFormJsunit() { } } var innerEvent = { - eventId: 41, + eventId: 46, priority: events_emitter.EventPriority.LOW } console.info("[testTransForm004] start to publish emit"); diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/Utils.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/Utils.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f4b16d766f1feeb75edd8cc84cd1448d61e569a --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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. + */ + +export default class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..3d21b801cfbf1c4d1f9af98e5f3d2a323877142c --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/test/VisibilityJsunit.test.ets @@ -0,0 +1,111 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; +export default function visibilityJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("visibility beforeEach start"); + let options = { + uri: 'pages/visibility', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get visibility state pages:" + JSON.stringify(pages)); + if (!("visibility" == pages.name)) { + console.info("get visibility state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push visibility page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push visibility page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("visibility after each called"); + }); + + it('testVisibility01', 0, async function (done) { + console.info('[testVisibility01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility01] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.Visible'); + console.info('[testVisibility01] END'); + done(); + }); + + it('testVisibility02', 0, async function (done) { + console.info('[testVisibility02] START'); + try { + var eventData = { + data: { + "visibility": Visibility.Hidden, + } + } + var innerEvent = { + eventId: 47, + priority: events_emitter.EventPriority.LOW + } + console.info("[testVisibility02] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testVisibility02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.Hidden'); + console.info('[testVisibility02] END'); + done(); + }); + + it('testVisibility03', 0, async function (done) { + console.info('[testVisibility03] START'); + try { + var eventData = { + data: { + "visibility": Visibility.None, + } + } + var innerEvent = { + eventId: 48, + priority: events_emitter.EventPriority.LOW + } + console.info("[testVisibility03] start to publish emit:" + JSON.stringify(eventData.data)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testVisibility03] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('box'); + let obj = JSON.parse(strJson); + console.info("[testVisibility03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.visibility).assertEqual('Visibility.None'); + console.info('[testVisibility03] END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/utils/Constants.ets b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/utils/Constants.ets new file mode 100755 index 0000000000000000000000000000000000000000..13a6c0d16e7277756efb5136ce8b02ac6b601d50 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @ts-nocheck +/** + * 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/ace/ace_ets_component_five/entry/src/main/resources/base/element/color.json b/ace/ace_ets_component_five/entry/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_five/entry/src/main/resources/base/element/float.json b/ace/ace_ets_component_five/entry/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_five/entry/src/main/resources/base/element/string.json b/ace/ace_ets_component_five/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..ff4014526837abe1fd58255faac5456a6be449d0 --- /dev/null +++ b/ace/ace_ets_component_five/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_five/entry/src/main/resources/base/media/bg.jpg b/ace/ace_ets_component_five/entry/src/main/resources/base/media/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/resources/base/media/bg.jpg differ diff --git a/ace/ace_ets_component_five/entry/src/main/resources/base/media/icon.png b/ace/ace_ets_component_five/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/resources/base/media/icon.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/resources/rawfile/ic_health_heart.png b/ace/ace_ets_component_five/entry/src/main/resources/rawfile/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/resources/rawfile/ic_health_heart.png differ diff --git a/ace/ace_ets_component_five/entry/src/main/resources/rawfile/test.png b/ace/ace_ets_component_five/entry/src/main/resources/rawfile/test.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_five/entry/src/main/resources/rawfile/test.png differ diff --git a/ace/ace_ets_component_five/signature/openharmony_sx.p7b b/ace/ace_ets_component_five/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/ace/ace_ets_component_five/signature/openharmony_sx.p7b differ diff --git a/ace/ace_ets_component_four/BUILD.gn b/ace/ace_ets_component_four/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..4c18e6dc6ea28a0caf962994fee0d0cbae67f3bc --- /dev/null +++ b/ace/ace_ets_component_four/BUILD.gn @@ -0,0 +1,32 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("AceEtsComponentFourTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_component_assets", + ":ace_ets_component_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AceEtsComponentFourTest" +} +ohos_js_assets("ace_ets_component_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("ace_ets_component_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ace/ace_ets_component_four/Test.json b/ace/ace_ets_component_four/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..7e33ac0178e14f2015055825547924b316d7c9ff --- /dev/null +++ b/ace/ace_ets_component_four/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.open.harmony.acetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "AceEtsComponentFourTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ace/ace_ets_component_four/entry/src/main/config.json b/ace/ace_ets_component_four/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..75119998a5336fcfd4b62fb7036ec3daf00e24a8 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetestfour", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.acetestfour", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.acetestfour.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/calendar", + "pages/customDialogController", + "pages/dragEvent", + "pages/dragEvent2", + "pages/enumsItemAlign", + "pages/enumsLineCapStyle", + "pages/focus", + "pages/geometryTransition", + "pages/gestureMode", + "pages/image", + "pages/ohosPrompt", + "pages/panDirection", + "pages/path", + "pages/patternLock", + "pages/playMode", + "pages/polygon", + "pages/polyline", + "pages/refresh", + "pages/richText", + "pages/sideBar", + "pages/systemRouterA", + "pages/systemRouterB", + "pages/textArea", + "pages/textClock", + "pages/textInput", + "pages/textPickerDialog", + "pages/textTimer", + "pages/video" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/app.ets similarity index 63% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/app.ets index e515e3338b60969508297192374239675bb20e05..31244da536cdae3b268f6df0a8b08a1b527be445 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/app.ets @@ -1,28 +1,23 @@ -/** - * 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 events_emitter from '@ohos.events.emitter' - -@Entry -@Component -struct LoadingProgressExample { - build() { - Column({ space: 5 }) { - Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('90%') - LoadingProgress() - .color(Color.Blue) - }.width('100%').margin({ top: 6 }) - } +// @ts-nocheck +/** + * 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. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, } \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/bg.jpg b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/bg.jpg differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/clip.png b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/clip.png new file mode 100755 index 0000000000000000000000000000000000000000..8bf4be4ee8ed5f13f3c3f8e4881a898199e4a57c Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/clip.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/dialog.png b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/dialog.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/dialog.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/download.png b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/download.png new file mode 100755 index 0000000000000000000000000000000000000000..3b1d0fd10bd28897bf3b1103e5bdba0fdb9d17f1 Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/download.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/ic_health_heart.png b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/ic_health_heart.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.jpeg b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..30c4e9ecfe8396d327dfd5cf0528a43a4714db44 Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.jpeg differ diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.png b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.png new file mode 100755 index 0000000000000000000000000000000000000000..2a10f82cfa60d94e7a1ba9a613736739729c0cf6 Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/img.png differ diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/images/swipeDirection.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/swipeDirection.ets old mode 100644 new mode 100755 similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/images/swipeDirection.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/swipeDirection.ets index 40553dc9833e320801125e80b694ea99cdea2011..705f1293ab2f99534d1bc1b18f054817c301900f --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/images/swipeDirection.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/images/swipeDirection.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component struct PanGestureExample { diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/animatorOption.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/animatorOption.ets new file mode 100755 index 0000000000000000000000000000000000000000..faa4a4894ed4b9f74e9368f85eb86f5873746a63 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/animatorOption.ets @@ -0,0 +1,100 @@ +// @ts-nocheck +/** + * 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 animator from '@ohos.animator'; +import prompt from '@system.prompt'; + +@Entry +@Component +struct ColumnExample { + @State divWidth: number = 120; + @State divHeight: number = 120; + @State animation: AnimatorResult = animator.createAnimator({ + duration: 3000, + fill: 'forwards', + direction: "normal", + begin: 200, + end: 270 + }); + + onPageShow() { + this.animation.onrepeat(() => { + var repeatoptions = { + duration: 2000, + iterations: 1, + direction: 'alternate', + begin: 180, + end: 240 + }; + this.animation.update(repeatoptions); + this.animation.play(); + }); + } + + build() { + Column() { + Column() { + Column() { + Column().width(this.divWidth).height(this.divHeight).backgroundColor(0xAFEEEE) + }.width('100%') + }.width('100%').padding({ top: 5 }) + + Column() { + Row() { + Button('play').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.onframe((value) => { + this.divWidth = value + this.divHeight = value + }); + this.animation.play(); + }); + Button('update').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + var newoptions = { + duration: 5000, + iterations: 2, + begin: 120, + end: 180 + }; + this.animation.update(newoptions); + this.animation.play(); + }); + }.margin({ top: 5 }) + + Row() { + Button('pause').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.pause(); + }); + Button('finish').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.onfinish(() => { + prompt.showToast({ + message: 'finish' + }) + }); + this.animation.finish(); + }); + }.margin({ top: 5 }) + + Row() { + Button('cancel').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.cancel(); + }); + Button('reverse').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.reverse(); + }); + }.margin({ top: 5 }) + }.margin({ top: 30 }) + } + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/bindContextMenu.ets diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/calendar.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/calendar.ets new file mode 100755 index 0000000000000000000000000000000000000000..41b1465952ef883fd6080ea711e34b11633434cd --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/calendar.ets @@ -0,0 +1,203 @@ +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct CalendarComponentExample { + calendarController: CalendarController = new CalendarController(); + @State CalendarDayArray: CalendarDay[] = [{ + index: 1, + lunarMonth: "five", + lunarDay: "6", + dayMark: "六", + dayMarkValue: "儿童节", + year: 2020, + month: 11, + day: 10, + isFirstOfLunar: false, + markLunarDay: false + }]; + @State currentMonthday: MonthData = { + year: 2021, + month: 3, + data: this.CalendarDayArray + }; + @State preMonthday: MonthData = { + year: 2021, + month: 2, + data: this.CalendarDayArray + }; + @State nextMonthday: MonthData = { + year: 2021, + month: 4, + data: this.CalendarDayArray + }; + @State colorValue: Color = Color.Blue; + @State calendarDay1: CalendarDay = { + index: 6, + lunarMonth: "111", + lunarDay: "222", + dayMark: "333", + dayMarkValue: "444", + year: 2022, + month: 3, + day: 11, + isFirstOfLunar: false, + hasSchedule: false, + markLunarDay: false + } + @State calendarDay2: CalendarDay = { + index: 6, + lunarMonth: "111", + lunarDay: "222", + dayMark: "333", + dayMarkValue: "444", + year: 2022, + month: 3, + day: 10, + isFirstOfLunar: false, + hasSchedule: false, + markLunarDay: false + } + @State calendarDay3: CalendarDay = { + index: 6, + lunarMonth: "111", + lunarDay: "222", + dayMark: "333", + dayMarkValue: "444", + year: 2022, + month: 3, + day: 12, + isFirstOfLunar: false, + hasSchedule: false, + markLunarDay: false + } + @State currentData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay1] }; + @State preData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay2] }; + @State nextData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay3] }; + + @State colSpace: number = 5; + @State dailyFiveRowSpace: number = 4; + @State dailySixRowSpace: number = 5; + @State lunarHeight: number = 20; + @State underscoreWidth: number = 10; + @State underscoreLength: number = 6; + @State scheduleMarkerRadius: number = 3; + @State boundaryRowOffset: number = 3; + @State weekAndDayRowSpace: number = 3; + @State direction: Axis = Axis.Horizontal; + @State weekStyle: WeekStyle = { + weekColor: Color.black, + weekendDayColor: Color.red, + weekendLunarColor: Color.green, + weekFontSize: 1, + weekHeight: 2, + weekWidth: 3, + weekAndDayRowSpace: this.weekAndDayRowSpace + }; + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("Calendar page state change called:" + JSON.stringify(eventData)); + if (eventData.data.colSpace != null) { + this.colSpace = eventData.data.colSpace; + console.log("Calendar page colSpace value" + this.colSpace); + } + if (eventData.data.dailyFiveRowSpace != null) { + this.dailyFiveRowSpace = eventData.data.dailyFiveRowSpace; + console.log("Calendar page dailyFiveRowSpace value" + this.dailyFiveRowSpace); + } + if (eventData.data.dailySixRowSpace != null) { + this.dailySixRowSpace = eventData.data.dailySixRowSpace; + console.log("Calendar page dailySixRowSpace value" + this.dailySixRowSpace); + } + if (eventData.data.underscoreWidth != null) { + this.underscoreWidth = eventData.data.underscoreWidth; + console.log("Calendar page underscoreWidth value" + this.underscoreWidth); + } + if (eventData.data.underscoreLength != null) { + this.underscoreLength = eventData.data.underscoreLength; + console.log("Calendar page underscoreLength value" + this.underscoreLength); + } + if (eventData.data.lunarHeight != null) { + this.lunarHeight = eventData.data.lunarHeight; + console.log("Calendar page lunarHeight value" + this.lunarHeight); + } + if (eventData.data.scheduleMarkerRadius != null) { + this.scheduleMarkerRadius = eventData.data.scheduleMarkerRadius; + console.log("Calendar page scheduleMarkerRadius value" + this.scheduleMarkerRadius); + } + if (eventData.data.boundaryRowOffset != null) { + this.boundaryRowOffset = eventData.data.boundaryRowOffset; + console.log("Calendar page boundaryRowOffset value" + this.boundaryRowOffset); + } + + if (eventData.data.weekAndDayRowSpace != null) { + this.weekAndDayRowSpace = eventData.data.weekAndDayRowSpace; + console.log("Calendar page weekAndDayRowSpace value" + this.weekAndDayRowSpace); + } + + if (eventData.data.direction != null) { + this.direction = eventData.data.direction; + console.log("Calendar page direction value" + this.direction); + } + } + } + + onPageShow() { + console.info('Calendar page show called'); + var stateChangeEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { + Calendar({ + year: 2020, + month: 5, + day: 12 + }, this.currentMonthday, this.preMonthday, this.nextMonthday, this.calendarController) + .currentDayStyle({ + dayHeight: 30, + dayWidth: 30, + gregorianCalendarHeight: 30, + dayYAxisOffset: 1, + lunarDayYAxisOffset: 1, + underscoreXAxisOffset: 1, + underscoreYAxisOffset: 1, + scheduleMarkerXAxisOffset: 0, + scheduleMarkerYAxisOffset: 0, + colSpace: this.colSpace, + dailyFiveRowSpace: this.dailyFiveRowSpace, + dailySixRowSpace: this.dailySixRowSpace, + lunarHeight: this.lunarHeight, + underscoreWidth: this.underscoreWidth, + underscoreLength: this.underscoreLength, + scheduleMarkerRadius: this.scheduleMarkerRadius, + boundaryRowOffset: this.boundaryRowOffset + }) + .weekStyle(this.weekStyle) + .direction(this.direction) + .backgroundColor(0x317aff) + .width(100) + .height(50) + .key('calender') + }.height(400).padding({ left: 35, right: 35, top: 35 }) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/customDialogController.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/customDialogController.ets similarity index 77% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/customDialogController.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/customDialogController.ets index 50383253cfeda9afc96d976c0f781703abb00718..967513c427cbeb5f404035f8867f2d7cdf11d2d2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/customDialogController.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/customDialogController.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter'; @CustomDialog struct CustomDialogExample { @@ -48,6 +49,7 @@ struct CustomDialogUser { @State autoCancel: boolean = true @State customStyle: boolean = false @State alignment: DialogAlignment = DialogAlignment.Default + @State onClickValue: boolean = false private stateChangCallBack = (eventData) => { console.info("checkboxGroup page stateChangCallBack"); @@ -59,7 +61,7 @@ struct CustomDialogUser { onPageShow() { console.info('checkboxGroup page show called'); var stateChangeEvent = { - eventId: 43, + eventId: 79, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) @@ -89,7 +91,23 @@ struct CustomDialogUser { Column() { Button('click me') .onClick(() => { - this.dialogController.open() + this.onClickValue = true; + this.dialogController.open(); + try { + var backData = { + data: { + "ACTION": this.onClickValue + } + } + var backEvent = { + eventId: 236, + priority: events_emitter.EventPriority.LOW + } + console.info("click to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("click action state err: " + JSON.stringify(err.message)) + } }).backgroundColor(0x317aff).key('dialogController') }.width('100%').margin({ top: 5 }) } diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent.ets new file mode 100755 index 0000000000000000000000000000000000000000..08c3941b0fdd0a30777e1eba60d34a78aa27b9c0 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent.ets @@ -0,0 +1,220 @@ +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter' + +@Entry +@Component +struct DragExample { + @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'] + @State text: string = '' + @State bool: boolean = false + @State bool1: boolean = false + @State size: string = '' + @State appleVisible: Visibility = Visibility.Visible + @State orangeVisible: Visibility = Visibility.Visible + @State bananaVisible: Visibility = Visibility.Visible + @State mangoVisible: Visibility = Visibility.Visible + @State strawberryVisible: Visibility = Visibility.Visible + @State select: number = 0 + @State currentIndex: number = 0 + + @Builder pixelMapBuilder() { + Column() { + Text(this.text) + .width('50%').height(60).fontSize(16).borderRadius(10) + .textAlign(TextAlign.Center).backgroundColor(Color.Yellow) + } + } + + build() { + Column() { + Text('There are three Text elements here') + .fontSize(12).fontColor(0xCCCCCC).width('90%') + .textAlign(TextAlign.Start).margin(5) + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) { + Text('apple').width('25%').height(35).fontSize(16).key('apple') + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.appleVisible) + .onDragStart(() => { + this.bool = true + this.text = 'apple' + this.appleVisible = Visibility.Hidden + console.log('apple onDragStart onAction') + try { + var backData = { + data: { + "ACTION": 'onDragStart onAction' + } + } + var backEvent = { + eventId: 86, + priority: events_emitter.EventPriority.LOW + } + console.info("apple start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("apple emit action state err: " + JSON.stringify(err.message)) + } + return this.pixelMapBuilder + }) + Text('orange').width('25%').height(35).fontSize(16).key('orange') + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.orangeVisible) + .onDragStart(() => { + this.bool = true + this.text = 'orange' + this.orangeVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + Text('banana').width('25%').height(35).fontSize(16).key('banana') + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.bananaVisible) + .onDragStart((event: DragEvent, extraParams: string) => { + console.log('Text onDragStarts, ' + extraParams) + this.bool = true + this.text = 'banana' + this.bananaVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + Text('mango').width('25%').height(35).fontSize(16).key('mango') + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.mangoVisible) + .onDragStart(() => { + this.bool = true + this.text = 'mango' + this.mangoVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + Text('strawberry').width('25%').height(35).fontSize(16).key('strawberry') + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.strawberryVisible) + .onDragStart(() => { + this.bool = true + this.text = 'strawberry' + this.strawberryVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + }.border({ width: 1 }).width('90%').padding({ top: 10, bottom: 10 }).margin(10) + + Text('This is a List element').fontSize(12) + .fontColor(0xCCCCCC).width('90%') + .textAlign(TextAlign.Start).margin(15) + List({ space: 20, initialIndex: 0 }) { + ForEach(this.numbers, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(80).fontSize(16).borderRadius(10) + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + }.key('listItem') + .onDragStart((event: DragEvent, extraParams: string) => { + console.log('ListItem onDragStarts, ' + extraParams) + var jsonString = JSON.parse(extraParams) + this.bool1 = true + this.text = this.numbers[jsonString.selectedIndex] + this.select = jsonString.selectedIndex + return this.pixelMapBuilder + }) + }, item => item) + } + .editMode(true) + .height('50%').width('90%').border({ width: 1 }) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) + .onDragEnter((event: DragEvent, extraParams: string) => { + console.log('List onDragEnter, ' + extraParams + ',' + event.getX() + ',' + event.getY()) + try { + var backData = { + data: { + "pointX": event.getX(), + "pointY": event.getY() + } + } + var backEvent = { + eventId: 87, + priority: events_emitter.EventPriority.LOW + } + console.info("onDragEnter start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onDragEnter emit action state err: " + JSON.stringify(err.message)) + } + }) + .onDragMove((event: DragEvent, extraParams: string) => { + console.log('List onDragMove, ' + extraParams) + try { + var backData = { + data: { + "ACTION": 'onDragMove onAction' + } + } + var backEvent = { + eventId: 88, + priority: events_emitter.EventPriority.LOW + } + console.info("onDragMove start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onDragMove emit action state err: " + JSON.stringify(err.message)) + } + }) + .onDragLeave((event: DragEvent, extraParams: string) => { + console.log('List onDragLeave, ' + extraParams) + try { + var backData = { + data: { + "ACTION": 'onDragLeave onAction' + } + } + var backEvent = { + eventId: 89, + priority: events_emitter.EventPriority.LOW + } + console.info("onDragLeave start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onDragLeave emit action state err: " + JSON.stringify(err.message)) + } + }) + .onDrop((event: DragEvent, extraParams: string) => { + console.log('onDrop onAction') + try { + var backData = { + data: { + "ACTION": 'onDrop onAction' + } + } + var backEvent = { + eventId: 90, + priority: events_emitter.EventPriority.LOW + } + console.info("onDrop start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onDrop emit action state err: " + JSON.stringify(err.message)) + } + var jsonString = JSON.parse(extraParams) + if (this.bool) { + this.numbers.splice(jsonString.insertIndex, 0, this.text) + this.bool = false + } else if (this.bool1) { + this.numbers.splice(jsonString.selectedIndex, 1) + this.numbers.splice(jsonString.insertIndex, 0, this.text) + this.bool = false + this.bool1 = false + } + }) + }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/dragEvent.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent2.ets similarity index 86% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/dragEvent.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent2.ets index 06236eed1c5029bebfed9b2916fab343b3243fb2..9fc9fbe402f880f9f8d985bb96881fc611044382 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/dragEvent.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/dragEvent2.ets @@ -16,7 +16,7 @@ @Entry @Component -struct DragExample { +struct Drag2Example { @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'] @State text: string = '' @State bool: boolean = false @@ -45,10 +45,11 @@ struct DragExample { .fontSize(12).fontColor(0xCCCCCC).width('90%') .textAlign(TextAlign.Start).margin(5) Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) { - Text('apple').width('25%').height(35).fontSize(16) + Text('apple').width('25%').height(35).fontSize(16).key('apple') .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) .visibility(this.appleVisible) .onDragStart(() => { + console.log('Ting--onDragStart--apple') this.bool = true this.text = 'apple' this.appleVisible = Visibility.Hidden @@ -58,6 +59,7 @@ struct DragExample { .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) .visibility(this.orangeVisible) .onDragStart(() => { + console.log('Ting--onDragStart--orange') this.bool = true this.text = 'orange' this.orangeVisible = Visibility.Hidden @@ -67,11 +69,12 @@ struct DragExample { .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) .visibility(this.bananaVisible) .onItemDragStart((event: ItemDragInfo, itemIndex: number) => { - console.info(ItemDragInfo.x) - console.info(ItemDragInfo.y) + console.info('Ting--onItemDragStart' + event.x) + console.info('Ting--onItemDragStart' + event.y) }) .onDragStart((event: DragEvent, extraParams: string) => { console.log('Text onDragStarts, ' + extraParams) + console.log('Ting--onDragStart--banana') this.bool = true this.text = 'banana' this.bananaVisible = Visibility.Hidden @@ -80,7 +83,7 @@ struct DragExample { "extraInfo": "aaa", "pixelMap" :PixelMapMock.release() } - return obj; + return this.pixelMapBuilder(); }) }.border({ width: 1 }).width('90%').padding({ top: 10, bottom: 10 }).margin(10) @@ -94,8 +97,9 @@ struct DragExample { Text('' + item) .width('100%').height(80).fontSize(16).borderRadius(10) .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) - } + }.key('listItem') .onDragStart((event: DragEvent, extraParams: string) => { + console.log('Ting--onDragStart--ListItem') console.log('ListItem onDragStarts, ' + extraParams) var jsonString = JSON.parse(extraParams) this.bool1 = true @@ -110,12 +114,15 @@ struct DragExample { .height('50%').width('90%').border({ width: 1 }) .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) .onDragEnter((event: DragEvent, extraParams: string) => { + console.log('Ting--onDragEnter') console.log('List onDragEnter, ' + extraParams + ',' + event.getX() + ',' + event.getY()) }) .onDragMove((event: DragEvent, extraParams: string) => { + console.log('Ting--onDragMove') console.log('List onDragMove, ' + extraParams) }) .onDragLeave((event: DragEvent, extraParams: string) => { + console.log('Ting--onDragLeave') console.log('List onDragLeave, ' + extraParams) }) .onDrop((event: DragEvent, extraParams: string) => { @@ -129,6 +136,7 @@ struct DragExample { this.bool = false this.bool1 = false } + console.log('Ting--onDrop') }) }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets index 81d63ad8df7fa29745b816487379516c4d6956f7..e3a42d82150ceac138bd3fbc94956f2efc2cfeb9 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsItemAlign.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets index c38cf02ec3dee958716cc1d3b84cb9dce43d885e..bb08deec7570edd002d774c5ec0db7212c2e3f6e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/enumsLineCapStyle.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/focus.ets similarity index 74% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/focus.ets index 0e874bbc17a49286f2973342065b55bcf6de55a7..6e50b9faee573d5188daef09881ea4abb0510d96 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/focus.ets @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events_emitter from '@ohos.emitter' @Entry @Component @@ -23,13 +24,14 @@ struct FocusableExample { @State oneButtonColor: string = '#FF0000' @State twoButtonColor: string = '#FFC0CB' @State threeButtonColor: string = '#87CEFA' + @State focusable: boolean = false build() { Column({ space:20 }){ Button(this.textOne) .backgroundColor(this.oneButtonColor) .width(300).height(70).fontColor(Color.Black) - .focusable(true) + .focusable(this.focusable) .onFocus(() => { this.textOne = 'First Button onFocus' this.oneButtonColor = '#AFEEEE' @@ -41,7 +43,7 @@ struct FocusableExample { Button(this.textTwo) .backgroundColor(this.twoButtonColor) .width(300).height(70).fontColor(Color.Black) - .focusable(true) + .focusable(this.focusable) .onFocus(() => { this.textTwo = 'Second Button onFocus' this.twoButtonColor = '#AFEEEE' @@ -53,7 +55,7 @@ struct FocusableExample { Button(this.textThree) .backgroundColor(this.threeButtonColor) .width(300).height(70).fontColor(Color.Black) - .focusable(false) + .focusable(this.focusable) .onFocus(() => { this.textThree = 'Third Button onFocus' this.threeButtonColor = '#AFEEEE' @@ -67,4 +69,22 @@ struct FocusableExample { }) }.width('100%').margin({ top:20 }) } + + onPageShow(){ + console.info('focus page show called'); + var stateChangeEvent = { + eventId: 101, + priority:events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack) + } + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("focus page state change called:" + JSON.stringify(eventData)); + if (eventData.data.focusable != null) { + this.focusable = eventData.data.focusable; + } + } + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fontWeight.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/fontWeight.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fontWeight.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/fontWeight.ets index 4d657bf2ba446b09b077ce82c45d68aa80b284ba..8f4214876464a29bccd8ca91c306474e707e4a67 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/fontWeight.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/fontWeight.ets @@ -14,7 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component struct ContentTable { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/geometryTransition.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/geometryTransition.ets similarity index 65% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/geometryTransition.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/geometryTransition.ets index 9baa590cdc797adbf91ccb385014590d428e1b8b..4166246684a4ab919d9c9e669eb1010819e5a9e8 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/geometryTransition.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/geometryTransition.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,17 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter'; @Entry @Component struct geometryTransitionExample { @State btn1: boolean = false @State show: string = "show" + build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) { - Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}) + Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}).key('button') .onClick(() => { + try { + var backData = { + data: { + "btn1": this.btn1, + } + } + var backEvent = { + eventId: 104, + priority: events_emitter.EventPriority.LOW + } + console.info("geometryTransitionTest_0100 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("geometryTransitionTest_0100 emit action state err: " + JSON.stringify(err.message)) + } animateTo({ duration: 1000 }, () => { this.btn1 = !this.btn1 if(this.btn1){ @@ -36,8 +53,7 @@ struct geometryTransitionExample { Button() { Image($rawfile('ic_health_heart.png')).width("80%").height(300) }.geometryTransition('geometryTransition') - .geometryTransition('geometryTransition2') } }.height(400).width("100%").padding({top:100}) } -} \ No newline at end of file +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureMode.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/gestureMode.ets similarity index 75% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureMode.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/gestureMode.ets index 0af198407b4ccfc2b78d4c1472cad678b86f9db0..8ba0cf0b5c10553cdb988379679b1d156d52eb18 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gestureMode.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/gestureMode.ets @@ -14,7 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component struct GestureGroupExample { @@ -28,6 +27,7 @@ struct GestureGroupExample { Flex({ direction: FlexDirection.Column, mode:this.mode, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) } + .key('gestureMode') .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyle }) .gesture( @@ -50,29 +50,10 @@ struct GestureGroupExample { this.offsetY = event.offsetY console.log('pan update') }) - .key('gestureMode') ) .onCancel(() => { console.log('sequence gesture canceled') }) ) } - - onPageShow() { - console.info('gestureMode page show called'); - var stateChangeEvent = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("gestureMode page state change called:" + JSON.stringify(eventData)); - if (eventData.data.mode != null) { - this.mode = eventData.data.mode; - } - } - } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/grid.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/grid.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/grid.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/grid.ets index e58a67687568144cf2bf897b10d3b8460de17474..d2d7843b449387e7d800c2af9ad2e3079f5eedf7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/grid.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/grid.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/image.ets similarity index 52% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/image.ets index 013b1f4fe4ab8ae7b1fd5b59c596113698523c4a..d2d37dc8ada48e0b73d909a8d9bd25577239ceea 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/image.ets @@ -14,21 +14,29 @@ * limitations under the License. */ -import router from '@system.router' - @Entry @Component -struct NavigatorDetailCode { - @State text: string = router.getParams().text +struct ImageExample { + @State fontSize: number = 9; + @State fontColor: string = "0xCCCCCC"; + @State textAlign: TextAlign = TextAlign.Start; + @State textOverflow: TextOverflow = TextOverflow.Clip; + @State decoration: TextDecorationType = TextDecorationType.None; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { - Navigator({ target: 'pages/NavigatorBackCode', type: NavigationType.Push }) { - Text('Go to back page').width('100%').height(20) - } - - Text('This is ' + this.text + ' page').width('100%').textAlign(TextAlign.Center) + Text('string_hello') + .fontSize(this.fontSize) + .fontColor(this.fontColor) + .textAlign(this.textAlign) + .textOverflow({ overflow: this.textOverflow }) + .decoration({ type: this.decoration, color: Color.Red }) + .key('text') + Image($rawfile('test.png')) + .key('image') } - .width('100%').height(200).padding({ left: 35, right: 35, top: 35 }) + .height(600) + .width(350) + .padding({ left: 35, right: 35, top: 35 }) } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageFit.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/imageFit.ets similarity index 83% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageFit.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/imageFit.ets index f659b4dc57d122bb5f39eb861e36740a15ce639d..59658715b32558bacfb6af52b743e301e4153d48 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageFit.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/imageFit.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component struct ImageExample1 { @@ -34,6 +33,10 @@ struct ImageExample1 { .border({ width: 1 }).borderStyle(BorderStyle.Dashed) .objectFit(ImageFit.Auto).width(110).height(110) .overlay('Auto', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Image($rawfile('ic_health_heart.png')) + .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .objectFit(ImageFit.Contain).width(110).height(110) + .overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } } }.height(320).width(360).padding({ right: 10, top: 10 }) diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..a9c75c7154b8b5d6f5f76b1cf05cff275d4386f4 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +// @ts-nocheck +/** + * 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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lazyForEach.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/lazyForEach.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lazyForEach.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/lazyForEach.ets diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/mouseEvent.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets similarity index 58% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/mouseEvent.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets index 44b1c81dac5bc1507b11ac13a4cb039859e966ce..1823f24f15d394e8037ef7cbfa67ffc6b90900ea 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/mouseEvent.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/mouseEvent.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component @@ -21,6 +20,8 @@ struct MouseEventExample { @State hoverText: string = 'no hover' @State mouseText: string = 'MouseText' @State color: Color = Color.Blue + @State eventButton: string = '' + @State eventAction: string = '' build() { Column({ space:20 }) { @@ -37,9 +38,23 @@ struct MouseEventExample { .backgroundColor(this.color) Button('onMouse') .onMouse((event: MouseEvent) => { - console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + - '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + - '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + if (event.button === MouseButton.Back) { + this.eventButton = 'Back' + } + if (event.button === MouseButton.None) { + this.eventButton = 'None' + } + if (event.event.action === MouseAction.Release) { + this.eventAction = 'Release' + } + if (event.event.action === MouseAction.Hover) { + this.eventAction = 'Hover' + } + if (event.event.action === MouseAction.None) { + this.eventAction = 'None' + } + console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + console.log(this.mouseText = 'onMouse:\nButton = ' + this.eventAction + '\nAction = ' + this.eventAction + '\nlocalXY=(' + event.x + ',' + event.y + ')' + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') stopPropagation: () => { console.info('stopPropagation') } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets index 2f6a024acb88caf7e9f9b35fd5ef4eaa4503da65..526215274d707240fc8f23fd0de393735c36e6e7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/ohosPrompt.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' import prompt from '@ohos.prompt' @Entry @@ -33,7 +33,7 @@ struct OhosPrompt { } } var backEvent = { - eventId: 30, + eventId: 142, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panDirection.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets similarity index 70% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panDirection.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets index 20d18d81f52aba8a4ef90f79046a1d285d368013..340dff72a0139155278e64e666f2b5d53b055275 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panDirection.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets @@ -14,7 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' @Entry @Component struct PanGestureExample { @@ -30,6 +29,7 @@ struct PanGestureExample { .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .gesture( PanGesture({}) + .direction(this.direction) .setDirection(this.direction) .onActionStart((event: PanGestureEvent) => { console.info('Pan start') @@ -43,22 +43,4 @@ struct PanGestureExample { }) ) } - - onPageShow() { - console.info('panDirection page show called'); - var stateChangeEvent = { - eventId: 167, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack) - } - - private stateChangCallBack = (eventData) => { - if (eventData != null) { - console.info("panDirection page state change called:" + JSON.stringify(eventData)); - if (eventData.data.direction != null) { - this.direction = eventData.data.direction; - } - } - } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panel.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panel.ets index 415a7fe7286236df9dec2c1acbcc2dcab7789e0e..2be12f7c2f75a686ac97d6e535ba8f9cc7ff4c09 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panel.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -35,17 +36,17 @@ struct PanelExample { onPageShow() { console.info('rating page show called'); var stateChangeEvent = { - eventId: 440, + eventId: 147, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 441, + eventId: 148, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 442, + eventId: 149, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/path.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/path.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/path.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/path.ets index 5c7b0e91a9e78b64b10ecf8483941579c54a7e91..1f8f4e9409289e7a2b54d283b4acabf8032d05f8 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/path.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/path.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -26,7 +27,7 @@ struct PathExample { onPageShow() { console.info('[path] page show called '); var stateChangeEvent = { - eventId: 101, + eventId: 151, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/patternLock.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/patternLock.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/patternLock.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/patternLock.ets index 03b81a88dd2c6edcb2d33f87c709c4eb1fab436b..f40c07c9ef484a14176e09a279dff45fae08596e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/patternLock.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/patternLock.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -32,7 +32,7 @@ struct PatternLockExample { onPageShow() { console.info('[PatternLock] page show called'); var stateChangeEvent = { - eventId: 71, + eventId: 152, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -106,7 +106,7 @@ struct PatternLockExample { } } var backEvent = { - eventId: 70, + eventId: 153, priority: events_emitter.EventPriority.LOW } console.info("reset button start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/playMode.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/playMode.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/playMode.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/playMode.ets index 1d2c4c4ea5020c74df54ab6dd9121f45546190b2..d652678e0192fa1cf601a6ba68f375a28e56c425 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/playMode.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/playMode.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -33,7 +33,7 @@ struct PlayModeExample { } } var backEvent = { - eventId: 1111, + eventId: 161, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/polygon.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/polygon.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/polygon.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/polygon.ets diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/polyline.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/polyline.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/polyline.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/polyline.ets diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/refresh.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/refresh.ets similarity index 90% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/refresh.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/refresh.ets index 5ac154ce1e825750fe35696a59462baf7372e9a6..1ff22cdc50f7e6215b31d5c911e62f3f22a7c42e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/refresh.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/refresh.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import eventsEmitter from '@ohos.events.emitter'; +import eventsEmitter from '@ohos.emitter'; @Entry @Component @@ -24,7 +24,7 @@ struct RefreshCreateComponent { onPageShow() { console.info('[list] page show called'); var stateChangeEvent = { - eventId: 602, + eventId: 180, priority: eventsEmitter.EventPriority.LOW } eventsEmitter.on(stateChangeEvent, this.stateChangCallBack); @@ -42,9 +42,6 @@ struct RefreshCreateComponent { build() { Column() { - - Button('ok!').type(ButtonType.Normal).key('buttonBao') - Refresh({ refreshing: this.isRefreshing, offset: 120, friction: 100 }) { Text('Pull Down and refresh: ' + this.counter) .fontSize(30) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/richText.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/richText.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/richText.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/richText.ets index 5193854ac1d4e6fbcd714ac6de1f929425a69b47..95dc9126612bc3094aa1b94cf733f758fbcef890 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/richText.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/richText.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import eventsEmitter from '@ohos.events.emitter'; +import eventsEmitter from '@ohos.emitter'; @Entry @Component @@ -23,7 +23,7 @@ struct RichTextCreateComponent { onPageShow() { console.info('[list] page show called'); var stateChangeEvent = { - eventId: 601, + eventId: 181, priority: eventsEmitter.EventPriority.LOW } eventsEmitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sideBar.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/sideBar.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sideBar.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/sideBar.ets index 5ef92e0fbc789c3069b9e1b6a3fb0bd2c7a6f351..801a2999ea0fb4e6c57eb661a5ab604988974229 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sideBar.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/sideBar.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -48,7 +48,7 @@ struct SideBarExample { onPageShow() { console.info('sideBar page show called'); var stateChangeEvent = { - eventId: 45, + eventId: 195, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterA.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterA.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterA.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterA.ets index e29a7a8cef4dc107638135ae3d37dcd39acf50e7..972e09ed3c08b5cc6fc6fd5b56fbf8bffdd338c6 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterA.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterA.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +16,6 @@ import router from '@system.router'; - @Entry @Component struct SystemRouterA { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterB.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterB.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterB.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterB.ets index ea8ecd06237f28c16d952f99cfcdac650329bbdf..129424b19011acb59b293e830cf09458f717f231 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemRouterB.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/systemRouterB.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,8 +15,7 @@ */ import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; - +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -42,7 +42,7 @@ struct SystemRouterB { } } let paramsEvent = { - eventId: 3, + eventId: 211, priority: events_emitter.EventPriority.LOW } console.info("[SystemRouterB] start to emit params"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textArea.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textArea.ets similarity index 55% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textArea.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textArea.ets index 07d04e19ac625fae944c8d4b02b193c4829a5c2a..9959e4ad162290807a21b66caa3c35ba8eb36c7d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textArea.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textArea.ets @@ -13,46 +13,47 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component struct TextAreaExample2 { - @State text: string = 'textArea'; - @State textAlign: TextAlign = TextAlign.Center; + @State text: string = 'TextArea' @State fontColor: string = "Color.Red"; @State fontSize: number = 30; - @State onActionCalledOne: boolean = false; - @State onActionCalledTwo: boolean = false; + @State textAlign: TextAlign = TextAlign.Center; + @State text: String = 'test text'; onPageShow() { console.info('swiper page show called'); var stateChangeEvent = { - eventId: 1315, + eventId: 215, priority: events_emitter.EventPriority.LOW } + console.log("fang--->B"); events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { - eventId: 1316, + eventId: 216, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 1317, + eventId: 217, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 1318, + eventId: 218, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) } private stateChangCallBack = (eventData) => { + console.info("fang--->A"); if (eventData != null) { console.info("swiper page state change called:" + JSON.stringify(eventData)); if (eventData.data.fontSize != null) { @@ -64,12 +65,15 @@ struct TextAreaExample2 { if (eventData.data.textAlign != null) { this.textAlign = eventData.data.textAlign; } + if (eventData.data.text != null) { + this.text = eventData.data.text; + } } } build() { Column() { - TextArea({ placeholder: 'input your word'}) + TextArea({ placeholder: 'input your word', text: this.text}) .key('textArea') .placeholderColor("rgb(0,0,225)") .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) @@ -82,58 +86,11 @@ struct TextAreaExample2 { .fontStyle(FontStyle.Normal) .fontColor(this.fontColor) .inputFilter('^[\u4E00-\u9FA5A-Za-z0-9_]+$',(value: string) => { - console.info("hyb"+value) }) .onChange((value: string) => { this.text = value }) - .onCut((value: string) => { - this.text = value - console.info(index.toString()) - this.onActionCalledOne = true; - console.info('onChange current action state is: ' + this.onActionCalledOne); - try { - var backData = { - data: { - "ACTION": this.onActionCalledOne, - } - } - var backEvent = { - eventId: 2020, - priority: events_emitter.EventPriority.LOW - } - console.info("onChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onChange emit action state err: " + JSON.stringify(err.message)) - } - }) - .onPaste((value: string) => { - this.text = value - console.info(index.toString()) - this.onActionCalledTwo = true; - console.info('onChange current action state is: ' + this.onActionCalledTwo); - try { - var backData = { - data: { - "ACTION": this.onActionCalledTwo, - } - } - var backEvent = { - eventId: 2021, - priority: events_emitter.EventPriority.LOW - } - console.info("onChange start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("onChange emit action state err: " + JSON.stringify(err.message)) - } - }) Text(this.text).width('90%').key('text') - Button('caretPosition') - .onClick(() => { - this.controller.caretPosition(4) - }) - } } - } \ No newline at end of file + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textClock.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textClock.ets similarity index 86% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textClock.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textClock.ets index 066613dc55d6a7501c31b845981914fc36878ffb..1d8aeaacaf851c1728af19621b79f9356779d7e0 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textClock.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textClock.ets @@ -13,40 +13,40 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component struct Second { @State accumulateTime: number = 0; @State fontSize: number = 20; - @State fontColor: string = 'Color.Red'; - @State format: string = 'hhmmss'; + @State fontColor: Color= Color.Red; + @State format: string = "hhmmss"; @State onActionCalled: boolean = false; controller: TextClockController = new TextClockController(); onPageShow() { console.info('swiper page show called'); var stateChangeEvent = { - eventId: 1215, + eventId: 219, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { - eventId: 1216, + eventId: 220, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 1217, + eventId: 221, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 1218, + eventId: 222, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) @@ -56,7 +56,7 @@ struct Second { if (eventData != null) { console.info("swiper page state change called:" + JSON.stringify(eventData)); if (eventData.data.fontSize != null) { - this.fontSize = parseInt(eventData.data.fontSize); + this.fontSize = eventData.data.fontSize; } if (eventData.data.fontColor != null) { this.fontColor = eventData.data.fontColor; @@ -64,18 +64,22 @@ struct Second { if (eventData.data.format != null) { this.format = eventData.data.format; } + if (eventData.data.onActionCalled != null) { + this.onActionCalled = eventData.data.onActionCalled; + } } } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) { Text('current milliseconds is' + this.accumulateTime) - .key('text') .fontSize(this.fontSize) .fontColor(this.fontColor) TextClock({timeZoneOffset: -8, controller: this.controller}) .key('textClock') .format(this.format) + .fontSize(this.fontSize) + .fontColor(this.fontColor) .onDateChange((value: number) => { this.accumulateTime = value this.onActionCalled= true; @@ -87,7 +91,7 @@ struct Second { } } var backEvent = { - eventId: 3080, + eventId: 223, priority: events_emitter.EventPriority.LOW } console.info("onChange start to emit action state") @@ -116,7 +120,7 @@ struct Second { } } var backEvent = { - eventId: 1129, + eventId: 224, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets new file mode 100755 index 0000000000000000000000000000000000000000..c991aef8db4dd86d68514a4f77b90cb07d11c4f2 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets @@ -0,0 +1,84 @@ +// @ts-nocheck +/** + * 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 events_emitter from '@ohos.emitter'; + +@Entry +@Component +struct TextAreaExample2 { + @State text: string = 'TextInput'; + @State inputType: InputType = InputType.Normal; + @State fontSize: number = 16; + @State fontColor: Color = Color.Black; + @State textAlign: TextAlign = TextAlign.Start; + + onPageShow() { + var stateChangeEvent = { + eventId: 225, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack) + } + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("swiper page state change called:" + JSON.stringify(eventData)); + if (eventData.data.fontSize != null) { + this.fontSize = parseInt(eventData.data.fontSize); + } + if (eventData.data.fontColor != null) { + this.fontColor = eventData.data.fontColor; + } + if (eventData.data.textAlign != null) { + this.textAlign = eventData.data.textAlign; + } + if (eventData.data.type != null) { + this.inputType = eventData.data.type; + } + if (eventData.data.Text != null) { + this.text = eventData.data.text; + } + } + } + + build() { + Column() { + TextArea({ placeholder: 'input your word' }) + .key('TextInput') + .type(this.inputType) + .placeholderColor("rgb(0,0,225)") + .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .textAlign(this.textAlign) + .caretColor(Color.Blue) + .height(50) + .fontSize(this.fontSize) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(this.fontColor) + .inputFilter('^[\u4E00-\u9FA5A-Za-z0-9_]+$',(value: string) => { + console.info("hyb"+value) + }) + .onChange((value: string) => { + this.text = value + }) + Text(this.text).width('90%').key('text') + Button('caretPosition') + .onClick(() => { + this.controller.caretPosition(4) + }) + } + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets index 9f0be8d3f54c503e9efd9eec8dbd2c87cd0eeace..8527e0d118f3c1ae2bdecb5a3ed708c4507bdc0e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textPickerDialog.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textTimer.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textTimer.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textTimer.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textTimer.ets index b2093fca5cc762ef6a803c534c485679fa7a545e..f57536e86896657ff6c6ab247f56a711eeae796f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/textTimer.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textTimer.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; @Entry @Component diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/video.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/video.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/video.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/video.ets index a5f9a41aa15eb1c5505fe0806faf8bbb0c81007d..929d67efa652ffd5d8253bb259ad11e394aa26f2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/video.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/video.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import eventsEmitter from '@ohos.events.emitter'; +import eventsEmitter from '@ohos.emitter'; @Entry @Component @@ -29,7 +29,7 @@ struct VideoCreateComponent { onPageShow() { console.info('[list] page show called'); var stateChangeEvent = { - eventId: 600, + eventId: 235, priority: eventsEmitter.EventPriority.LOW } eventsEmitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets similarity index 86% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets index c16e5998803bc64e2d785adf0d1e71afd5277c1b..f087c78a8ac8439e0fa79ae98b0a5d5244213352 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/AppStorageJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; export default function AppStorageJsunit() { @@ -64,12 +63,6 @@ export default function AppStorageJsunit() { .assertTrue; let key1 = AppStorage.Get("key1"); console.info('[stateManagement_AppStorage_setOrCreate_0100] key1 = ' + key1); - // let staticClear = AppStorage.staticClear(); - // console.info('[stateManagement_AppStorage_setOrCreate_0100] staticClear =' +staticClear); - // expect(staticClear).assertTrue; - // let size1 = AppStorage.Size(); - // console.info('[stateManagement_AppStorage_setOrCreate_0100] size1 =' +size1); - // expect(size1 == 0).assertTrue; console.info('[stateManagement_AppStorage_setOrCreate_0100] END'); done(); }); @@ -164,15 +157,19 @@ export default function AppStorageJsunit() { key: "layoutDirection", defaultValue: LayoutDirection.LTR }] }; - Environment.EnvProps(props); - let enable = AppStorage.Get("colorMode"); - let enable1 = AppStorage.Get("layoutDirection"); - expect(enable == ColorMode.LIGHT) - .assertTrue; - expect(enable1 == LayoutDirection.RTL) - .assertTrue; - console.info('[stateManagement_Environment_EnvProps_0100] enable = ' + enable); - console.info('[stateManagement_Environment_EnvProps_0100] enable1 = ' + enable1); + try { + Environment.EnvProps(props); + let enable = AppStorage.Get("colorMode"); + let enable1 = AppStorage.Get("layoutDirection"); + expect(enable == ColorMode.LIGHT) + .assertTrue; + expect(enable1 == LayoutDirection.RTL) + .assertTrue; + console.info('[stateManagement_Environment_EnvProps_0100] enable = ' + enable); + console.info('[stateManagement_Environment_EnvProps_0100] enable1 = ' + enable1); + } catch(err) { + console.info('[stateManagement_Environment_EnvProps_0100] err = ' + err); + } console.info('[stateManagement_Environment_EnvProps_0100] END'); done(); }); diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/BasicJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/BasicJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..94afbd0338fb4dfdf1b04cc65e4f43967c074188 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/BasicJsunit.test.ets @@ -0,0 +1,70 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; + +export default function basicJsunit() { + describe('basicTest', function () { + let callback: Callback = (data) => { + console.log(data); + expect(true).assertTrue(); + } + + function callbackTest(callback: Callback): void { + callback("callback"); + } + + let errorCallback: ErrorCallback = (error) => { + console.log(error); + expect(true).assertTrue(); + } + + function errorCallbackTest(errorCallback: ErrorCallback): void { + errorCallback("errorCallback"); + } + + let asyncCallback: AsyncCallback = (error, data) => { + console.log(data); + expect(true).assertTrue(); + } + + function asyncCallbackTest(asyncCallback: AsyncCallback): void { + asyncCallback({ + code: 1 + }, "asyncCallback"); + } + + it('testBasic01', 0, async function (done) { + console.info('[testBasic01] START'); + callbackTest(callback); + console.info('[testBasic01] END'); + done(); + }); + + it('testBasic02', 0, async function (done) { + console.info('[testBasic02] START'); + errorCallbackTest(errorCallback); + console.info('[testBasic02] END'); + done(); + }); + + it('testBasic03', 0, async function (done) { + console.info('[testBasic03] START'); + asyncCallbackTest(asyncCallback); + console.info('[testBasic03] END'); + done(); + }); + }); +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CalendarJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CalendarJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0430aad9f62eeafbf97c251286294d41829d5036 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CalendarJsunit.test.ets @@ -0,0 +1,267 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function calendarJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("calendar beforeEach start"); + let options = { + uri: 'pages/calendar', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get calendar state pages: " + JSON.stringify(pages)); + if (!("calendar" == pages.name)) { + console.info("get calendar state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push calendar page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push calendar page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("calendar after each called"); + }) + + it('ACE_calendar_CurrentDayStyle_colSpace', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_colSpace] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "colSpace": 10, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_colSpace] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_colSpace] change component data error: " + err.message); + } + done(); + }); + + it('ACE_calendar_CurrentDayStyle_dailyFiveRowSpace', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "dailyFiveRowSpace": 11, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_dailySixRowSpace', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_dailySixRowSpace] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "dailySixRowSpace": 12, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_dailySixRowSpace] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_dailySixRowSpace] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_lunarHeight', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_lunarHeight] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "lunarHeight": 13, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_lunarHeight] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_lunarHeight] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_underscoreWidth', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_underscoreWidth] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "underscoreWidth": 14, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_underscoreWidth] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_underscoreWidth] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_underscoreLength', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_underscoreLength] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "underscoreLength": 15, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_underscoreLength] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_underscoreLength] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_scheduleMarkerRadius', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "scheduleMarkerRadius": 16, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CurrentDayStyle_boundaryRowOffset', 0, async function (done) { + console.info('[ACE_calendar_CurrentDayStyle_boundaryRowOffset] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "boundaryRowOffset": 17, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CurrentDayStyle_boundaryRowOffset] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CurrentDayStyle_boundaryRowOffset] change component data error: " + err.message); + } + done(); + }); + + it('ACE_calendar_WeekStyle_weekAndDayRowSpace', 0, async function (done) { + console.info('[ACE_calendar_WeekStyle_weekAndDayRowSpace] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "weekAndDayRowSpace": 18, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_WeekStyle_weekAndDayRowSpace] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_WeekStyle_weekAndDayRowSpace] change component data error: " + err.message); + } + done(); + }); + + + it('ACE_calendar_CalendarAttribute_direction', 0, async function (done) { + console.info('[ACE_calendar_CalendarAttribute_direction] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "direction": Axis.Vertical, + } + } + var innerEvent = { + eventId: 74, + priority: events_emitter.EventPriority.LOW + } + console.info("[ACE_calendar_CalendarAttribute_direction] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ACE_calendar_CalendarAttribute_direction] change component data error: " + err.message); + } + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets similarity index 97% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets index 494b5f3a79af16c6b6edb8350949a3125f2dc8f1..43005d5013df11994ed2148e24153b525ac8ae32 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ContentStorage.test.ets @@ -14,7 +14,6 @@ * limitations under the License. */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import utils from './Utils'; export default function ContentStorageJsunit() { describe('ContentStorage', function () { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets similarity index 58% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets index c69e6cf0e24acaf9d154a7b6231c005a46c127a7..28c0e6280e50be92534510b187a2089d63f922f4 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/CustomDialogControllerJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,35 +47,24 @@ export default function customDialogControllerJsunit() { it('testCustomDialogControllers_100', 0, async function (done) { console.info('[testCustomDialogControllers_100] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('dialogController'); - let obj = JSON.parse(strJson); - console.info("testCustomDialogControllers_100 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("100.000000vp"); - console.info('testCustomDialogControllers_100 END'); - done(); - }); - - it('testCustomDialogControllers_200', 0, async function (done) { - console.info('[testCustomDialogControllers_200] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('dialogController'); - let obj = JSON.parse(strJson); - console.info("testCustomDialogControllers_200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("100.000000vp"); - console.info('testCustomDialogControllers_200 END'); + var callback = (eventData) => { + console.info("[testClickEvent001] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true) + } + var innerEvent = { + eventId: 236, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testClickEvent001] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testClickEvent001] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, ""))); + await Utils.sleep(1000) + console.info('[testClickEvent001] testSendTouchEvent END'); done(); }); - it('testCustomDialogControllers_300', 0, async function (done) { - console.info('[testCustomDialogControllers_300] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('dialogController'); - let obj = JSON.parse(strJson); - console.info("testCustomDialogControllers_300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("100.000000vp"); - console.info('testCustomDialogControllers_300 END'); - done(); - }); }) } \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/DragEventJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/DragEventJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6348cfd0c9b551195b1007f520177cf3c0b44cb2 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/DragEventJsunit.test.ets @@ -0,0 +1,189 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; +import events_emitter from '@ohos.events.emitter'; + +export default function dragEventJsunit(){ + describe('dragEventTest', function (){ + beforeEach(async function (done) { + let options = { + uri: 'pages/dragEvent', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get dragEvent state success " + JSON.stringify(pages)); + if (!("dragEvent" == pages.name)) { + console.info("get dragEvent state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push dragEvent page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push dragEvent page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("dragEvent after each called"); + }); + + it('dragEventTest_0100', 0, async function (done) { + console.info('dragEventTest_0100 START'); + let rect = await Utils.getComponentRect('apple') + console.info("dragEventTest_0100 rectInfo is " + JSON.stringify(rect)); + let downX = rect.left + (rect.right - rect.left) / 2; + let downY = rect.top + (rect.bottom - rect.top) / 2; + let rectOne = await Utils.getComponentRect('listItem') + console.info("dragEventTest_0100 rectOneInfo is " + JSON.stringify(rectOne)); + let upX = rectOne.left + (rectOne.right - rectOne.left) / 2; + let upY = rectOne.top + (rectOne.bottom - rectOne.top) / 2; + await Utils.drag(downX, downY, upX, upY, 10) + let callback = (indexEvent) => { + console.info("dragEventTest_0100 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual('onDragStart onAction'); + } + let indexEvent = { + eventId: 86, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("dragEventTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info('dragEventTest_0100 END'); + done(); + }); + + it('dragEventTest_0200', 0, async function (done) { + console.info('dragEventTest_0200 START'); + let rect = await Utils.getComponentRect('orange') + console.info("dragEventTest_0200 rectInfo is " + JSON.stringify(rect)); + let downX = rect.left + (rect.right - rect.left) / 2; + let downY = rect.top + (rect.bottom - rect.top) / 2; + let rectOne = await Utils.getComponentRect('listItem') + console.info("dragEventTest_0200 rectOneInfo is " + JSON.stringify(rectOne)); + let upX = rectOne.left + (rectOne.right - rectOne.left) / 2; + let upY = rectOne.top + (rectOne.bottom - rectOne.top) / 2; + await Utils.drag(downX, downY, upX, upY, 10) + let callback = (indexEvent) => { + console.info("dragEventTest_0200 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.pointX).assertNotEqual(Null); + expect(indexEvent.data.pointY).assertNotEqual(Null); + } + let indexEvent = { + eventId: 87, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("dragEventTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info('dragEventTest_0200 END'); + done(); + }); + + it('dragEventTest_0300', 0, async function (done) { + console.info('dragEventTest_0300 START'); + let rect = await Utils.getComponentRect('banana') + console.info("dragEventTest_0300 rectInfo is " + JSON.stringify(rect)); + let downX = rect.left + (rect.right - rect.left) / 2; + let downY = rect.top + (rect.bottom - rect.top) / 2; + let rectOne = await Utils.getComponentRect('listItem') + console.info("dragEventTest_0300 rectOneInfo is " + JSON.stringify(rectOne)); + let upX = rectOne.left + (rectOne.right - rectOne.left) / 2; + let upY = rectOne.top + (rectOne.bottom - rectOne.top) / 2; + await Utils.drag(downX, downY, upX, upY, 10) + let callback = (indexEvent) => { + console.info("dragEventTest_0300 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual('onDragMove onAction'); + } + let indexEvent = { + eventId: 88, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("dragEventTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info('dragEventTest_0300 END'); + done(); + }); + + it('dragEventTest_0400', 0, async function (done) { + console.info('dragEventTest_0400 START'); + let rect = await Utils.getComponentRect('mango') + console.info("dragEventTest_0400 rectInfo is " + JSON.stringify(rect)); + let downX = rect.left + (rect.right - rect.left) / 2; + let downY = rect.top + (rect.bottom - rect.top) / 2; + let rectOne = await Utils.getComponentRect('listItem') + console.info("dragEventTest_0400 rectOneInfo is " + JSON.stringify(rectOne)); + let upX = rectOne.right + (rect.right - rect.left); + let upY = rectOne.bottom + (rect.bottom - rect.top); + await Utils.drag(downX, downY, upX, upY, 10) + let callback = (indexEvent) => { + console.info("dragEventTest_0400 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual('onDragLeave onAction'); + } + let indexEvent = { + eventId: 89, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("dragEventTest_0400 on events_emitter err : " + JSON.stringify(err)); + } + console.info('dragEventTest_0400 END'); + done(); + }); + + it('dragEventTest_0500', 0, async function (done) { + console.info('dragEventTest_0500 START'); + let rect = await Utils.getComponentRect('strawberry') + console.info("dragEventTest_0500 rectInfo is " + JSON.stringify(rect)); + let downX = rect.left + (rect.right - rect.left) / 2; + let downY = rect.top + (rect.bottom - rect.top) / 2; + let rectOne = await Utils.getComponentRect('listItem') + console.info("dragEventTest_0500 rectOneInfo is " + JSON.stringify(rectOne)); + let upX = rectOne.left + (rectOne.right - rectOne.left) / 2; + let upY = rectOne.top + (rectOne.bottom - rectOne.top) / 2; + await Utils.drag(downX, downY, upX, upY, 10) + let callback = (indexEvent) => { + console.info("dragEventTest_0500 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual('onDrop onAction'); + } + let indexEvent = { + eventId: 90, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("dragEventTest_0500 on events_emitter err : " + JSON.stringify(err)); + } + console.info('dragEventTest_0500 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets similarity index 91% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets index 605aaa5b6467610e11563b03235cebfdb0869a49..0c13b4acd9a250088bdca909f1b92a057504b8fc 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusItemAlignJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsFlexItemJsunit() { @@ -52,11 +51,10 @@ export default function enumsFlexItemJsunit() { let strJson = getInspectorByKey('itemAlign'); console.info("enumsItemAlignTest_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); - console.info("enumsItemAlignTest_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.constructor.justifyContent).assertEqual('ItemAlign.Auto'); + console.info("enumsItemAlignTest_0100 component obj is: " + JSON.stringify(obj.$attrs.constructor)); + expect(obj.$attrs.constructor.alignItems).assertEqual('FlexAlign.SpaceEvenly'); console.info('enumsItemAlignTest_0100 END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets index f5c26044c6da7d9cd30a8b6d268e1eff131bcb10..935a2fc38ea9940f5147d5a08f594554621c07f0 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/EnmusLineCapStyleJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function enumsImageJsunit() { @@ -52,7 +51,8 @@ export default function enumsImageJsunit() { console.info("enumsLineCapStyleTest_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("enumsLineCapStyleTest_0100 component obj is: " + JSON.stringify(obj)); -// expect(obj.$attrs.backgroundImageSize).assertEqual('ImageSize.Auto'); + console.info('obj.$attrs.strokeLineCap' + obj.$attrs.strokeLineCap) + expect(obj.$attrs.strokeLineCap).assertEqual('LineCapStyle.Butt'); console.info('enumsLineCapStyleTest_0100 END'); done(); }); diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/FocusJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/FocusJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..7c9bd70fc925088ac279181cc2bd0ca751dbf2de --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/FocusJsunit.test.ets @@ -0,0 +1,71 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function focusJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("focus beforeEach start"); + let options = { + uri: 'pages/focus', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get focus state pages:" + JSON.stringify(pages)); + if (!("focus" == pages.name)) { + console.info("get focus state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push focus page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push focus page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("focus after each called"); + }); + + it('focusTest_0100', 0, async function (done) { + console.info('focusTest_0100 START'); + try { + let eventData = { + data: { + "focusable": true + } + } + let indexEventOne = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + console.info("focusTest_0100 start to publish emit"); + events_emitter.emit(indexEventOne, eventData); + } catch (err) { + console.log("focusTest_0100 change component data error: " + err.message); + } + await Utils.sleep(2000); + console.info('focusTest_0100 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GeometryTransitionJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GeometryTransitionJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..927ef5a839d63926c7013e04e663751a9cbe8035 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GeometryTransitionJsunit.test.ets @@ -0,0 +1,70 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function geometryTransitionJsunit() { + describe('geometryTransitionTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/geometryTransition', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get geometryTransition state success " + JSON.stringify(pages)); + if (!("geometryTransition" == pages.name)) { + console.info("get geometryTransition state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push geometryTransition page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push geometryTransition page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("geometryTransition after each called"); + }); + + it('geometryTransitionTest_0100', 0, async function (done) { + console.info('geometryTransitionTest_0100 START'); + let indexEvent = { + eventId: 104, + priority: events_emitter.EventPriority.LOW + } + await Utils.sleep(1000); + let callback = (indexEvent) => { + console.info("geometryTransitionTest_0100 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.btn1).assertEqual(false); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("geometryTransitionTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info("geometryTransitionTest_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + console.info('geometryTransitionTest_0100 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets similarity index 57% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets index d59340bb4048eff0542e7f4442ded1950a6a709c..c26270c720c2d09918b8d59365cc082ee8a7ea21 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/GestureModeJsunit.test.ets @@ -16,7 +16,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; export default function fontWeightJsunit() { describe('fontWeightTest', function () { @@ -51,44 +50,8 @@ export default function fontWeightJsunit() { console.info("fillModeText_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("fillModeText_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('PanGesture'); + expect(obj.$type).assertEqual('Flex'); done(); }); - - it('fillModeText_0200', 0, async function (done) { - console.info('fillModeText_0200 START'); - let strJson = getInspectorByKey('PanGesture'); - console.info("fillModeText_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("fillModeText_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.mode).assertEqual('GestureMode.Sequence'); - done(); - }); - - it('fillModeText_0300', 0, async function (done) { - console.info('fillModeText_0300 START'); - try { - let eventData = { - data: { - "mode": "GestureMode.Exclusive", - } - } - let indexEvent = { - eventId: 47, - priority: events_emitter.EventPriority.LOW - } - console.info("fillModeText_0300 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("fillModeText_0300 change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJsonNew = getInspectorByKey('PanGesture'); - let objNew = JSON.parse(strJsonNew); - console.info("fillModeText_0300 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.mode).assertEqual('GestureMode.Exclusive'); - console.info('fillModeText_0300 END'); - done(); - }); }) } \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ImageJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ImageJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..5cf697f696fd1e1ea4c95d9a8f745fd7c473267b --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/ImageJsunit.test.ets @@ -0,0 +1,79 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import Utils from './Utils'; + +export default function imageJsunit() { + describe('imageText', function () { + beforeEach(async function (done) { + console.info("image beforeEach start"); + let options = { + uri: 'pages/image', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get image state pages:" + JSON.stringify(pages)); + if (!("image" == pages.name)) { + console.info("get image state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push image page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push image page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("image after each called"); + }); + + it('imageTest_0100', 0, async function (done) { + console.info('imageTest_0100 START'); + await Utils.sleep(4000); + let strJson = getInspectorByKey('text'); + console.info("imageTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("imageTest_0100 obj.$attrs.content is: " + obj.$attrs.content); + expect(obj.$attrs.content).assertEqual('Hello'); + expect(obj.$attrs.fontSize).assertEqual('9.00fp'); + console.info('imageTest_0100 END'); + done(); + }); + + it('imageTest_0200', 0, async function (done) { + console.info('imageTest_0200 START'); + await Utils.sleep(3000); + let strJson = getInspectorByKey('image'); + console.info("imageTest_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("imageTest_0200 obj.$attrs.src is: " + obj.$attrs.src); + console.info("imageTest_0200 obj.obj.$type is: " + obj.$type); + var res = obj.$attrs.src.indexOf('rawfile/test.png'); + console.info("imageTest_0200 result is: " + res); + var sres = obj.$attrs.src.slice(res, res + 16); + console.info("imageTest_0200 slice result is: " + sres); + expect(obj.$type).assertEqual('Image'); + expect(obj.$attrs.src.slice(res, res + 16)).assertEqual('rawfile/test.png'); + console.info('imageTest_0200 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6c737f1aaf2ce0eac1aedce5e7e09eda6e0acba9 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,79 @@ +/** + * 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 systemRouterJsunit from './SystemRouterJsunit.test.ets'; +import systemAppJsunit from './SystemAppJsunit.test.ets'; +import patternLockJsunit from './PatternLockJsunit.test.ets'; +import customDialogControllerJsunit from './CustomDialogControllerJsunit.test.ets'; +import ohosPromptJsunit from './OhosPromptJsunit.test.ets'; +import videoJsunit from './VideoJsunit.test.ets'; +import refreshJsunit from './RefreshJsunit.test.ets'; +import richTextJsunit from './RichTextJsunit.test.ets'; +import textPickerJsunit from './TextPickerJsunit.test.ets'; +import textTimerJsunit from './TextTimerJsunit.test.ets'; +import subscribedAbstractPropertyJsunit from './SubscribedAbstractPropertyJsunit.test.ets'; +import contentStorageJsunit from './ContentStorage.test.ets'; +import appStorageJsunit from './AppStorageJsunit.test.ets'; +import subscribaleAbstractJsunit from './SubscribaleAbstractJsunit.test.ets'; +import pathJsunit from './PathJsunit.test.ets'; +import enumsLineCapStyleJsunit from './EnmusLineCapStyleJsunit.test.ets'; +import enmusItemAlignJsunit from './EnmusItemAlignJsunit.test.ets'; +import playModeJsunit from './PlayModeJsunit.test.ets'; +import GestureModeJsunit from './GestureModeJsunit.test.ets'; +import PanDirectionJsunit from './PanDirectionJsunit.test.ets'; +import basicJsunit from './BasicJsunit.test.ets'; +import focusJsunit from './FocusJsunit.test.ets'; +import textAreaJsunit from './TextAreaJsunit.test.ets'; +import dragEventJsunit from './DragEventJsunit.test.ets'; +import calendarJsunit from './CalendarJsunit.test.ets'; +import geometryTransitionJsunit from './GeometryTransitionJsunit.test.ets'; +import textClockJsunit from './TextClockJsunit.test.ets'; +import textInputJsunit from './TextInputJsunit.test.ets'; +import polygonJsunit from './PolygonJsunit.test.ets'; +import polylineJsunit from './PolylineJsunit.test.ets'; +import imageJsunit from './ImageJsunit.test.ets'; + +export default function testsuite() { + videoJsunit(); + enmusItemAlignJsunit(); + patternLockJsunit(); + dragEventJsunit(); + polygonJsunit(); + customDialogControllerJsunit(); + ohosPromptJsunit(); + richTextJsunit(); + refreshJsunit(); + imageJsunit(); + textPickerJsunit(); + textTimerJsunit(); + subscribedAbstractPropertyJsunit(); + contentStorageJsunit(); + textClockJsunit(); + appStorageJsunit(); + subscribaleAbstractJsunit(); + pathJsunit(); + enumsLineCapStyleJsunit(); + playModeJsunit(); + GestureModeJsunit(); + basicJsunit(); + focusJsunit(); + textAreaJsunit(); + textInputJsunit(); + polylineJsunit(); + calendarJsunit(); + PanDirectionJsunit(); + geometryTransitionJsunit(); + systemRouterJsunit(); + systemAppJsunit(); +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets index 7ba26c37488dd034a341d982e2bab864539b4b12..6c5a0f4833bc997d1c736dd287ea66de89c405aa 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/OhosPromptJsunit.test.ets @@ -53,7 +53,7 @@ export default function ohosPromptJsunit() { expect(eventData.data.matrix1).assertEqual("[100, 10]") } var innerEvent = { - eventId: 30, + eventId: 142, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets similarity index 57% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets index 1e2087b962fe22bd2751fe5faa21d42d1d461a90..8cba0896dd316875a6f9227d0e194fe79acde006 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanDirectionJsunit.test.ets @@ -16,7 +16,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; export default function fontWeightJsunit() { describe('panDirectionTest', function () { @@ -51,44 +50,9 @@ export default function fontWeightJsunit() { console.info("panDirectionText_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("panDirectionText_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$type).assertEqual('PanGesture'); + expect(obj.$type).assertEqual('Flex'); done(); }); - it('panDirectionText_0200', 0, async function (done) { - console.info('panDirectionText_0200 START'); - let strJson = getInspectorByKey('panDirection'); - console.info("panDirectionText_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("panDirectionText_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.direction).assertEqual('PanDirection.All'); - done(); - }); - - it('panDirectionText_0300', 0, async function (done) { - console.info('panDirectionText_0300 START'); - try { - let eventData = { - data: { - "direction": "None", - } - } - let indexEvent = { - eventId: 167, - priority: events_emitter.EventPriority.LOW - } - console.info("panDirectionText_0300 start to publish emit"); - events_emitter.emit(indexEvent, eventData); - } catch (err) { - console.log("panDirectionText_0300 change component data error: " + err.message); - } - await Utils.sleep(3000); - let strJsonNew = getInspectorByKey('panDirection'); - let objNew = JSON.parse(strJsonNew); - console.info("panDirectionText_0300 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.direction).assertEqual('None'); - console.info('panDirectionText_0300 END'); - done(); - }); }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets index cb2b8d1467c94be040b00b01b2d295e5af653a91..8103f2ae8d07fafa2b7bc79ba4b9d0e87e7d1d11 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +55,7 @@ export default function panelJsunit() { } } var innerEvent = { - eventId: 440, + eventId: 147, priority: events_emitter.EventPriority.LOW } console.info("testPanel_100 start to publish emit"); @@ -82,7 +83,7 @@ export default function panelJsunit() { } } var innerEvent = { - eventId: 441, + eventId: 148, priority: events_emitter.EventPriority.LOW } console.info("testPanel_200 start to publish emit"); @@ -110,7 +111,7 @@ export default function panelJsunit() { } } var innerEvent = { - eventId: 442, + eventId: 149, priority: events_emitter.EventPriority.LOW } console.info("testPanel_300 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets index 8f1845b6a7fda173489bd4bc3685802089db225a..d3ba72c7a5d08defff7bb825646cf7f2d0315d76 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PathJsunit.test.ets @@ -69,7 +69,7 @@ export default function enableJsunit() { } } var innerEvent = { - eventId: 101, + eventId: 151, priority: events_emitter.EventPriority.LOW } console.info("[testPath02] start to publish emit"); diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a6e506ebb8711407a7c4b8b55c05c1b37891be7f --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PatternLockJsunit.test.ets @@ -0,0 +1,72 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function patternLockJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("patternLock beforeEach start"); + let options = { + uri: 'pages/patternLock', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get patternLock state pages: " + JSON.stringify(pages)); + if (!("button" == pages.name)) { + console.info("get patternLock state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push patternLock page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push patternLock page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("patternLock after each called"); + }) + + it('testPatternLock_01', 0, async function (done) { + console.info('testPatternLock_01 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("testPatternLock_01 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual(true); + } + let indexEvent = { + eventId: 153, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("testPatternLock_01 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testPatternLock_01 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); + await Utils.sleep(1000); + console.info('testPatternLock_01 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets index 97275de1a062965be6c636e1854861c48e78485c..0f7d0a0daf4a0554df58304b6d656c018d4d016e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PlayModeJsunit.test.ets @@ -50,7 +50,7 @@ export default function playModeJsunit(){ console.info('playModeTest_0100 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 1111, + eventId: 161, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets similarity index 87% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets index cfd1116f82d7fd373e0908450a5145c4161ce06a..88caa3953b5cd13b63fa4bc3b8e471f63c11982e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolygonJsunit.test.ets @@ -45,13 +45,13 @@ export default function polygonJsunit() { console.info("polygon after each called"); }); - it('testPolygon', 0, async function (done) { - console.info('[testPolygon] START'); + it('testPolygon001', 0, async function (done) { + console.info('[testPolygon001] START'); await Utils.sleep(1000); let strJson = getInspectorByKey('polygon'); let obj = JSON.parse(strJson); - console.info("[testPolygon] obj is: " + JSON.stringify(obj)); - console.info('[testPolygon] END'); + console.info("[testPolygon001] obj is: " + JSON.stringify(obj)); + console.info('[testPolygon001] END'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets similarity index 85% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets index 5f8a960b7a42ceb1efc22bfc71dc2779c5ee80c4..2dc862a80871e11c3911f441fe9891736f3675b7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/PolylineJsunit.test.ets @@ -45,13 +45,13 @@ export default function polylineJsunit() { console.info("polyline after each called"); }); - it('testPolygon', 0, async function (done) { - console.info('[testPolyline] START'); - await Utils.sleep(1000); + it('testPolyline001', 0, async function (done) { + console.info('[testPolyline001] START'); + await Utils.sleep(4000); let strJson = getInspectorByKey('polyline'); let obj = JSON.parse(strJson); - console.info("[testPolyline] obj is: " + JSON.stringify(obj)); - console.info('[testPolyline] END'); + console.info("[testPolyline001] obj is: " + JSON.stringify(obj)); + console.info('[testPolyline001] END'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets similarity index 97% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets index 1171047cd226c250046a01f90229171c5879ce55..0137bda5fe3ac5a1a15712f1c19e08bffbffff96 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RefreshJsunit.test.ets @@ -67,6 +67,5 @@ export default function refreshJsunit() { console.info('[testRefresh03] END'); done(); }); - }); } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets index 6ce653b26d0edb6831b0ef9c3e784d636f903853..e4ea6317252e2cb24715a0e6111540bbd9e1a6fb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/RichTextJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; export default function richTextJsunit() { @@ -53,6 +52,5 @@ export default function richTextJsunit() { console.info('[testRichText01] END'); done(); }); - }); } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets similarity index 97% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets index cb155bc80afac1dd92cad5952274d09f31475edf..f59acce3a9498a4812582b41cce693563f84b252 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribaleAbstractJsunit.test.ets @@ -14,7 +14,6 @@ * limitations under the License. */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; -import utils from './Utils'; export default function SubscribaleAbstractJsunit() { describe('SubscribaleAbstract', function () { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets similarity index 88% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets index 90892d3e84bee782d0b5ee2de6ab4918e1c3dda3..b355282585735ce5a27a365d3bbaccd9f5cae562 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SubscribedAbstractPropertyJsunit.test.ets @@ -14,9 +14,6 @@ * limitations under the License. */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" -import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' -import Utils from './Utils'; export default function subscribedAbstractPropertyJsunit() { describe('appInfoTest', function () { @@ -39,7 +36,6 @@ export default function subscribedAbstractPropertyJsunit() { subscribedAbstractProperty.info_ = "subscribtest"; subscribedAbstractProperty.subscribers_ = 'subscribtest'; console.info('[subscribedAbstractProperty0100] END'); - //expect(obj.$attrs.type).assertEqual('ButtonType.Normal'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets similarity index 87% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets index e8fe8d2efee3c6cd456cb6078bead4072c24ce26..08dffce78591c5c212efa898ad5eaef09a22f6df 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets @@ -48,16 +48,24 @@ export default function systemAppJsunit() { it('systemAppTest_0400', 0, async function (done) { console.info('systemAppTest_0400 START'); - var a = 2000; - app.requestFullWindow(a); + try { + var a = 2000; + app.requestFullWindow(a); + } catch (err) { + console.log("systemAppTest_0400 error: " + err); + } console.info('systemAppTest_0400 END'); done(); }); it('systemAppTest_0500', 0, async function (done) { console.info('systemAppTest_0500 START'); - var visible = true; - app.screenOnVisible(visible); + try { + var visible = true; + app.screenOnVisible(visible); + } catch (err) { + console.log("systemAppTest_0500 error: " + err); + } console.info('systemAppTest_0500 END'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets index 87aaae260de7481d5d5c454f99f7f65af2854df8..0423228e77f25af210c60d6a3b5e044d47a7f999 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets @@ -30,7 +30,6 @@ export default function systemRouterJsunit() { await Utils.sleep(1000); console.info("[systemRouterTest001] push page success " + JSON.stringify(result)); let pages = router.getState(); - expect(pages.index).assertEqual(2); expect(pages.name).assertEqual('systemRouterA'); expect(pages.path).assertEqual('pages/'); } catch (err) { @@ -57,7 +56,7 @@ export default function systemRouterJsunit() { expect(paramsEvent.data.params).assertEqual('B Page'); } let paramsEvent = { - eventId: 3, + eventId: 211, priority: events_emitter.EventPriority.LOW } try { @@ -134,7 +133,7 @@ export default function systemRouterJsunit() { expect(paramsEvent.data.params).assertEqual('B Page'); } let paramsEvent = { - eventId: 3, + eventId: 211, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fe42b17f4c6a16acd245a154a80bdf2c6bbba46c --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets @@ -0,0 +1,235 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function textAreaJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("textArea beforeEach start"); + let options = { + uri: 'pages/textArea', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textArea state pages:" + JSON.stringify(pages)); + if (!("textArea" == pages.name)) { + console.info("get textArea state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textArea page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push textArea page error:" + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textArea after each called"); + }); + + it('textAreaTest01', 0, async function (done) { + console.info('[textAreaTest01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest01] obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontSize).assertEqual('30.00fp'); + console.info('textAreaTest01 END'); + done(); + }); + + it('textAreaTest02', 0, async function (done) { + console.info('[textAreaTest02] START'); + try { + var eventData = { + data: { + "fontSize": '50', + } + } + var innerEvent = { + eventId: 215, + priority: events_emitter.EventPriority.LOW + } + console.info("[textAreaTest02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textAreaTest02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontSize).assertEqual('50.00fp'); + console.info('textAreaTest02 END'); + done(); + }); + + it('textAreaTest03', 0, async function (done) { + console.info('[textAreaTest03] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontColor).assertEqual('#FF000000'); + console.info('textAreaTest03 END'); + done(); + }); + + it('textAreaTest04', 0, async function (done) { + console.info('[textAreaTest04] START'); + try { + var eventData = { + data: { + "fontColor": '#FFFF0000', + } + } + var innerEvent = { + eventId: 216, + priority: events_emitter.EventPriority.LOW + } + console.info("[textAreaTest04] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textAreaTest04] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest04] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000'); + console.info('textAreaTest04 END'); + done(); + }); + + it('textAreaTest05', 0, async function (done) { + console.info('[testArea05] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest05] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center'); + console.info('textAreaTest05 END'); + done(); + }); + + it('textAreaTest06', 0, async function (done) { + console.info('[textAreaTest06] START'); + try { + var eventData = { + data: { + "textAlign": 'TextAlign.Start', + } + } + var innerEvent = { + eventId: 217, + priority: events_emitter.EventPriority.LOW + } + console.info("[textAreaTest06] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textAreaTest06] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest06] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + console.info('textAreaTest06 END'); + done(); + }); + + it('textAreaTest07', 0, async function (done) { + console.info('[textAreaTest07] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest07] obj is: " + JSON.stringify(obj.$attrs.constructor)); + expect(obj.$attrs.constructor.text).assertEqual(undefined); + console.info('textAreaTest07 END'); + done(); + }); + + it('textAreaTest08', 0, async function (done) { + console.info('[textAreaTest08] START'); + try { + var eventData = { + data: { + "text": 'TextArea_1', + } + } + var innerEvent = { + eventId: 218, + priority: events_emitter.EventPriority.LOW + } + console.info("[textAreaTest08] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textAreaTest08] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest08] obj is: " + JSON.stringify(obj.$attrs.constructor)); + expect(obj.$attrs.constructor.text).assertEqual(undefined); + console.info('textAreaTest08 END'); + done(); + }); + + it('textAreaTest09', 0, async function (done) { + console.info('[textAreaTest09] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest09] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + console.info('textAreaTest09 END'); + done(); + }); + + it('textAreaTest10', 0, async function (done) { + console.info('[textAreaTest10] START'); + try { + var eventData = { + data: { + "textAlign": TextAlign.Start, + } + } + var innerEvent = { + eventId: 218, + priority: events_emitter.EventPriority.LOW + } + console.info("[textAreaTest10] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textAreaTest10] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textArea'); + let obj = JSON.parse(strJson); + console.info("[textAreaTest10] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + console.info('textAreaTest10 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..833c2138ea0ebce3f961fdf14204497a9696f831 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextClockJsunit.test.ets @@ -0,0 +1,160 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function textClockJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("text beforeEach start"); + let options = { + uri: 'pages/textClock', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get text state pages:" + JSON.stringify(pages)); + if (!("text" == pages.name)) { + console.info("get text state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push text page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push text page error:" + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("text after each called"); + }); + + it('textClockTest01', 0, async function (done) { + console.info('textClockTest01 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textClock'); + let obj = JSON.parse(strJson); + console.info("textClockTest01 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontSize).assertEqual('30.00fp'); + await Utils.sleep(1000); + done(); + }); + + it('textClockTest02', 0, async function (done) { + console.info('[textClockTest02] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "fontSize": 30 + } + } + var innerEvent = { + eventId: 219, + priority: events_emitter.EventPriority.LOW + } + console.info("[textClockTest02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textClockTest02] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJsonNew = getInspectorByKey('textClock'); + let objNew = JSON.parse(strJsonNew); + console.info("[textClockTest02] component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.fontSize).assertEqual('30.00fp'); + done(); + }); + + it('textClockTest03', 0, async function (done) { + console.info('[textClockTest03] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('textClock'); + console.info("[textClockTest03] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[textClockTest03] fontColor:" + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000'); + done(); + }); + + it('textClockTest04', 0, async function (done) { + console.info('[textClockTest04] START'); + try { + let eventData = { + data: { + "fontColor": '#FF000990' + } + } + let indexEvent = { + eventId: 220, + priority: events_emitter.EventPriority.LOW + } + console.info("[textClockTest04] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[textClockTest04] change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('textClock'); + console.info("[textClockTest04] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[textClockTest04] fontColor:" + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#FF000990'); + done(); + }); + + it('textClockTest05', 0, async function (done) { + console.info('[textClockTest05] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('textClock'); + let obj = JSON.parse(strJson); + console.info("[textClockTest05] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.format).assertEqual('hhmmss'); + console.info('textClockTest05 END'); + done(); + }); + + it('textClockTest06', 0, async function (done) { + console.info('[textClockTest06] START'); + try { + var eventData = { + data: { + "format": '20', + } + } + var innerEvent = { + eventId: 221, + priority: events_emitter.EventPriority.LOW + } + console.info("[textClockTest06] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textClockTest06] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('textClock'); + let obj = JSON.parse(strJson); + console.info("[textClockTest06] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.format).assertEqual('20'); + console.info('textClockTest06 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f30ebb78a815a1171b08f2e627c3e63e94e29ebf --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets @@ -0,0 +1,194 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function textInputJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("textInput beforeEach start"); + let options = { + uri: 'pages/textInput', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textInput state pages:" + JSON.stringify(pages)); + if (!("textInput" == pages.name)) { + console.info("get textInput state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textInput page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push textInput page error:" + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textInput after each called"); + }); + + it('textInputTest01', 0, async function (done) { + console.info('[textInputTest01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest01] obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontSize).assertEqual('16.00fp'); + console.info('textInputTest01 END'); + done(); + }); + + it('textInputTest02', 0, async function (done) { + console.info('[textInputTest02] START'); + try { + var eventData = { + data: { + "fontSize": '16', + } + } + var innerEvent = { + eventId: 225, + priority: events_emitter.EventPriority.LOW + } + console.info("[textInputTest02] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textInputTest02] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontSize).assertEqual('16.00fp'); + done(); + }); + + it('textInputTest03', 0, async function (done) { + console.info('[textInputTest03] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('TextInput'); + console.info("[textInputTest03] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[textInputTest03] fontColor:" + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual('#E6000000'); + done(); + }); + + it('textInputTest04', 0, async function (done) { + console.info('[textInputTest04] START'); + try { + var eventData = { + data: { + "fontColor": Color.Red + } + } + var innerEvent = { + eventId: 225, + priority: events_emitter.EventPriority.LOW + } + console.info("[textInputTest04] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textInputTest04] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest04] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fontColor).assertEqual('#E6000000'); + done(); + }); + + it('textInputTest05', 0, async function (done) { + console.info('[textInputTest05] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest05] obj is: " + JSON.stringify(obj)); + console.info("[textInputTest05] obj is: " + JSON.stringify(obj.$attrs.inputType)); + expect(obj.$attrs.inputType).assertEqual(undefined); + done(); + }); + + it('textInputTest06', 0, async function (done) { + console.info('[textInputTest06] START'); + try { + var eventData = { + data: { + "type": 'InputType.Email', + } + } + var innerEvent = { + eventId: 225, + priority: events_emitter.EventPriority.LOW + } + console.info("[textInputTest06] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textInputTest06] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest06] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.inputType).assertEqual(undefined); + done(); + }); + + it('textInputTest07', 0, async function (done) { + console.info('[textInputTest07] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('TextInput'); + console.info("[textInputTest07] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[textInputTest07] textAlign:" + obj.$attrs.textAlign); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + done(); + }); + + it('textInputTest08', 0, async function (done) { + console.info('[textInputTest08] START'); + try { + var eventData = { + data: { + "textAlign": 'TextAlign.Start' + } + } + var innerEvent = { + eventId: 225, + priority: events_emitter.EventPriority.LOW + } + console.info("[textInputTest08] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[textInputTest08] change component data error: " + err.message); + } + await Utils.sleep(1000); + let strJson = getInspectorByKey('TextInput'); + let obj = JSON.parse(strJson); + console.info("[textInputTest08] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets index e61a6a07597072080bbacd471fa2354eb0f8576c..e622281715219bb610ed8beef2d7a7bb43dc6a48 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextPickerJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; export default function textPickerJsunit() { @@ -55,7 +54,6 @@ export default function textPickerJsunit() { console.info("[testTextPickerDialog0100] component obj is: " + JSON.stringify(obj)); console.info("[testTextPickerDialog0100] expect(obj.$type) is: " + (obj.$type)); console.info("[testTextPickerDialog0100] obj.$attrs.type is: " + (obj.$attrs.type)); - //expect(obj.$attrs.type).assertEqual('ButtonType.Normal'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets index a301fbcbd68611d8078c6c5d07b3902b77d4a86a..4231b1f5b3bc93ef10ae5ecb72f9cb9c1c0c8e13 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/TextTimerJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' import Utils from './Utils'; export default function textTimerJsunit() { @@ -60,7 +59,6 @@ export default function textTimerJsunit() { return; } expect(obj.$type).assertEqual('TextTimer'); - //expect(obj.$attrs.type).assertEqual('ButtonType.Normal'); done(); }); diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/Utils.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/Utils.ets new file mode 100755 index 0000000000000000000000000000000000000000..aa94fe4f7e0a3a0c066b9141e118b2229c839a96 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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. + */ + +export default class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets similarity index 89% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets rename to ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets index 9a2398daaf12e42d94591e8390f5c74efe6ab4c6..5f1ba6d55be7469b388d05ef9f8b1efb71211e1c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/test/VideoJsunit.test.ets @@ -48,21 +48,6 @@ export default function videoJsunit() { it('testVideo01', 0, async function (done) { console.info('[testVideo01] START'); - try { - var eventData = { - data: { - "isStarted": true, - } - } - var innerEvent = { - eventId: 600, - priority: events_emitter.EventPriority.LOW - } - console.info("[testVideo01] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testVideo01] change component data error: " + err.message); - } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('video'); let objNew = JSON.parse(strJsonNew); @@ -80,7 +65,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo02] start to publish emit"); @@ -105,7 +90,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo03] start to publish emit"); @@ -130,7 +115,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo04] start to publish emit"); @@ -155,7 +140,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo05] start to publish emit"); @@ -180,7 +165,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo06] start to publish emit"); @@ -205,7 +190,7 @@ export default function videoJsunit() { } } var innerEvent = { - eventId: 600, + eventId: 235, priority: events_emitter.EventPriority.LOW } console.info("[testVideo07] start to publish emit"); diff --git a/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/utils/Constants.ets b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/utils/Constants.ets new file mode 100755 index 0000000000000000000000000000000000000000..13a6c0d16e7277756efb5136ce8b02ac6b601d50 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @ts-nocheck +/** + * 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/ace/ace_ets_component_four/entry/src/main/resources/base/element/color.json b/ace/ace_ets_component_four/entry/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/resources/base/element/float.json b/ace/ace_ets_component_four/entry/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/resources/base/element/string.json b/ace/ace_ets_component_four/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..ff4014526837abe1fd58255faac5456a6be449d0 --- /dev/null +++ b/ace/ace_ets_component_four/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_four/entry/src/main/resources/base/media/bg.jpg b/ace/ace_ets_component_four/entry/src/main/resources/base/media/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/resources/base/media/bg.jpg differ diff --git a/ace/ace_ets_component_four/entry/src/main/resources/base/media/icon.png b/ace/ace_ets_component_four/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/resources/base/media/icon.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/resources/rawfile/ic_health_heart.png b/ace/ace_ets_component_four/entry/src/main/resources/rawfile/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/resources/rawfile/ic_health_heart.png differ diff --git a/ace/ace_ets_component_four/entry/src/main/resources/rawfile/test.png b/ace/ace_ets_component_four/entry/src/main/resources/rawfile/test.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_four/entry/src/main/resources/rawfile/test.png differ diff --git a/ace/ace_ets_component_four/signature/openharmony_sx.p7b b/ace/ace_ets_component_four/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/ace/ace_ets_component_four/signature/openharmony_sx.p7b differ diff --git a/ace/ace_ets_component_three/BUILD.gn b/ace/ace_ets_component_three/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..c8417a6cf0f5bca81a486993bb7a4eb508a7a043 --- /dev/null +++ b/ace/ace_ets_component_three/BUILD.gn @@ -0,0 +1,32 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("AceEtsComponentThreeTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_component_assets", + ":ace_ets_component_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AceEtsComponentThreeTest" +} +ohos_js_assets("ace_ets_component_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("ace_ets_component_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ace/ace_ets_component_three/Test.json b/ace/ace_ets_component_three/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..b928c1a5e53eaecb25fb5e045f5c7d7da089dcc2 --- /dev/null +++ b/ace/ace_ets_component_three/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.open.harmony.acetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "AceEtsComponentThreeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ace/ace_ets_component_three/entry/src/main/config.json b/ace/ace_ets_component_three/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..5f1b8fc39c8f22a43659e314104a8caaa1c1216f --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/config.json @@ -0,0 +1,102 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetestthree", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.acetestthree", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.acetestthree.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/toggle", + "pages/gridPage", + "pages/span", + "pages/text", + "pages/badge", + "pages/canvas", + "pages/longPressGesture", + "pages/button", + "pages/ResponseRegion", + "pages/PanGesture", + "pages/background", + "pages/QrCode", + "pages/tabs", + "pages/tapGesture", + "pages/progress", + "pages/animate", + "pages/rating", + "pages/canvas2", + "pages/shape", + "pages/motionPath", + "pages/scrollCode", + "pages/transition", + "pages/priorityGesture", + "pages/parallelGesture", + "pages/blank", + "pages/sharedTransition", + "pages/sharedTransition2", + "pages/line", + "pages/circle", + "pages/aboutToDisappear", + "pages/timeStamp" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..52891e5511c95df08fd3e9965805e768c465e9ff --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,23 @@ +// @ts-nocheck +/** + * 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. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/bg.jpg b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/bg.jpg differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/clip.png b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/clip.png new file mode 100755 index 0000000000000000000000000000000000000000..8bf4be4ee8ed5f13f3c3f8e4881a898199e4a57c Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/clip.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/dialog.png b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/dialog.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/dialog.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/download.png b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/download.png new file mode 100755 index 0000000000000000000000000000000000000000..3b1d0fd10bd28897bf3b1103e5bdba0fdb9d17f1 Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/download.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/ic_health_heart.png b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/ic_health_heart.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.jpeg b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..30c4e9ecfe8396d327dfd5cf0528a43a4714db44 Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.jpeg differ diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.png b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.png new file mode 100755 index 0000000000000000000000000000000000000000..2a10f82cfa60d94e7a1ba9a613736739729c0cf6 Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/images/img.png differ diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/PanGesture.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets similarity index 55% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/PanGesture.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets index 2b8f0ae3ba3b5f2dfb4f4ccfcd892adfb5754193..51f4f87f2eb7ac0e0b96c5f91514e55a2e6146b2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/PanGesture.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component struct PanGestureExample { @State offsetX: number = 0 @State offsetY: number = 0 - @State touchable: boolean = false; + @State touchable: boolean = true; @State isTouched: boolean = false; onPageShow() { let ChangeEvent = { - eventId: 140, + eventId: 23, priority: events_emitter.EventPriority.LOW } events_emitter.on(ChangeEvent, this.ChangCallBack) @@ -53,36 +53,6 @@ struct PanGestureExample { .key('PanGesture') .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .touchable(this.touchable) - .onTouch((event: TouchEvent) => { - console.log('[PanGesture] TouchType start'); - this.isTouched = true - if (event.type === TouchType.Down) { - this.eventType = 'Down' - } - if (event.type === TouchType.Up) { - this.eventType = 'Up' - } - if (event.type === TouchType.Move) { - this.eventType = 'Move' - } - console.info('[PanGesture] TouchType:' + this.eventType) - try { - var backData = { - data: { - "ACTION": this.isTouched, - "EVENT_TYPE": this.eventType - } - } - var backEvent = { - eventId: 85, - priority: events_emitter.EventPriority.LOW - } - console.info("[PanGesture] start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("[PanGesture] emit action state err: " + JSON.stringify(err.message)) - } - }) .gesture( PanGesture({}) .setDirection(PanDirection.All) @@ -90,6 +60,15 @@ struct PanGestureExample { .setFingers(1) .onActionStart((event: PanGestureEvent) => { console.info('Pan start') + console.log('PanGesture globalX' + event.globalX); + console.log('PanGesture globalY' + event.globalY); + console.log('PanGesture localX' + event.localX); + console.log('PanGesture localY' + event.localY); + console.log('PanGesture fingerList' + event.fingerList); + console.log('PanGesture FingerInfo' + event.fingerList.FingerInfo); + console.log('PanGesture speed' + event.speed); + console.log('PanGesture pinchCenterX' + event.pinchCenterX); + console.log('PanGesture pinchCenterY' + event.pinchCenterY); }) .onActionUpdate((event: PanGestureEvent) => { this.offsetX = event.offsetX @@ -98,6 +77,36 @@ struct PanGestureExample { .onActionEnd(() => { console.info('Pan end') }) + .onTouch((event: TouchEvent) => { + console.log('[PanGesture] TouchType start'); + this.isTouched = true + if (event.type === TouchType.Down) { + this.eventType = 'Down' + } + if (event.type === TouchType.Up) { + this.eventType = 'Up' + } + if (event.type === TouchType.Move) { + this.eventType = 'Move' + } + console.info('[PanGesture] TouchType:' + this.eventType) + try { + var backData = { + data: { + "ACTION": this.isTouched, + "EVENT_TYPE": this.eventType + } + } + var backEvent = { + eventId: 24, + priority: events_emitter.EventPriority.LOW + } + console.info("[PanGesture] start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("[PanGesture] emit action state err: " + JSON.stringify(err.message)) + } + }) ) } } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/QrCode.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/QrCode.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets index cf602a258c0aebf3d5f01113c2b1fc723ffa83c2..e8abbe95dc539be30b8cae97d3abb117da350586 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/QrCode.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/QrCode.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -56,13 +56,13 @@ struct QrCode { onPageShow() { console.info('qrCode page show called'); var stateChangeEvent = { - eventId: 90, + eventId: 170, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 80, + eventId: 171, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBackTwo); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/ResponseRegion.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/ResponseRegion.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/ResponseRegion.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/ResponseRegion.ets index c3928f78aed14216ec66048fe49c4beb7fbe48b5..3f803f13167b3128f3bd08285c9360280022afc7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/ResponseRegion.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/ResponseRegion.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -24,7 +24,7 @@ struct ResponseRegionExample { onPageShow() { let ChangeEvent = { - eventId: 120, + eventId: 30, priority: events_emitter.EventPriority.LOW } events_emitter.on(ChangeEvent, this.ChangCallBack) @@ -75,7 +75,7 @@ struct ResponseRegionExample { } } var backEvent = { - eventId: 121, + eventId: 31, priority: events_emitter.EventPriority.LOW } console.info("[ResponseRegion] start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets index 50ff7694c9570ce6ada6f470a322d9dbbbf9acaa..4874ccc0650f51ccf70179af500409f1c7f0be20 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -66,7 +66,7 @@ struct TimerComponent { } } var backEvent = { - eventId: 160, + eventId: 49, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animate.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animate.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets index 7e6e18a2e2f9f8cdc2ee67c8cb0f991ccdfa10d8..f85cc77ae5f0a927581d83d95825e490ca315ded 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animate.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/animate.ets @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component - struct AnimationExample { @State btn1: boolean = false @State duration:number = 100 @@ -29,7 +28,7 @@ struct AnimationExample { onPageShow(){ console.info('animate page show called'); var stateChangeEvent = { - eventId: 65, + eventId: 50, priority:events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) @@ -68,7 +67,7 @@ struct AnimationExample { } } var backEvent = { - eventId: 60, + eventId: 51, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") @@ -92,7 +91,7 @@ struct AnimationExample { } } var backEventOne = { - eventId: 61, + eventId: 52, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -116,7 +115,7 @@ struct AnimationExample { } } var backEventTwo = { - eventId: 62, + eventId: 53, priority: events_emitter.EventPriority.LOW } console.info("button3 start to emit action state") @@ -140,7 +139,7 @@ struct AnimationExample { } } var backEventThree = { - eventId: 63, + eventId: 54, priority: events_emitter.EventPriority.LOW } console.info("button4 start to emit action state") @@ -164,7 +163,7 @@ struct AnimationExample { } } var backEventFour = { - eventId: 64, + eventId: 55, priority: events_emitter.EventPriority.LOW } console.info("button5 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/background.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/background.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/background.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/background.ets index cbd67fb8b9cd1c23f92d90bf57f950c87ead55d9..ffacec28f99bf2bc3e735a7fcd87fe3ec6041ba3 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/background.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/background.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -61,13 +61,13 @@ struct BackgroundExample { onPageShow() { console.info('background page show called'); var stateChangeEvent = { - eventId: 28, + eventId: 1, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEventTwo = { - eventId: 281, + eventId: 2, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets index fe2bc5b659ded22c99cf89a42c12d31b4baf483a..ab5d881c974a092cde4602a1ad480a416c717bb1 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/badge.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -41,7 +41,7 @@ struct BadgeExample { onPageShow() { console.info('Badge page show called'); var stateChangeEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/blank.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/blank.ets index e2789eba8b45d0c129a3fc7e7b281b66ceaa6029..c79701d659222fdea085eac9d662447e3628f68f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/blank.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -32,7 +32,7 @@ struct BlankExample { onPageShow() { console.info('Blank page show called'); var stateChangeEvent = { - eventId: 90, + eventId: 69, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/button.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets similarity index 70% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/button.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets index 72991790544ef4477876d2ef0e829caa7f5fbf6f..95fe6076cb47385deee3f8b6986c9534e2672e2e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/button.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -21,6 +21,8 @@ struct ButtonExample { @State buttonTypeValue: ButtonType = ButtonType.Normal; @State fontSizeValue: number = 20; @State fontColorValue: Color = Color.Black; + @State text: string = ''; + @State onClickValue: boolean = false; private stateChangCallBack = (eventData) => { if (eventData != null) { @@ -40,7 +42,7 @@ struct ButtonExample { onPageShow() { console.info('Button page show called'); var stateChangeEvent = { - eventId: 80, + eventId: 70, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -62,7 +64,7 @@ struct ButtonExample { } } var backEvent = { - eventId: 160, + eventId: 71, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -81,7 +83,7 @@ struct ButtonExample { } } var backEvent = { - eventId: 159, + eventId: 72, priority: events_emitter.EventPriority.LOW } console.info("button3 start to emit action state") @@ -90,6 +92,30 @@ struct ButtonExample { console.info("button3 emit action state err: " + JSON.stringify(err.message)) } }) + Button('Click').backgroundColor(0x2788D9).width(200).height(100).fontSize(20) + .onClick((event: ClickEvent) => { + console.info(this.text = 'Click Point:' + '\n screenX:' + event.screenX + '\n screenY:' + event.screenY + + '\n x :' + event.x + '\n y:' + event.y + '\ntarget:' + '\n component globalPos:(' + + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\n width:' + + event.target.area.width + '\n height:' + event.target.area.height); + this.onClickValue = true; + try { + var backData = { + data: { + "ACTION": this.onClickValue, + "event": JSON.stringify(event) + } + } + var backEvent = { + eventId: 4, + priority: events_emitter.EventPriority.LOW + } + console.info("click to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("click action state err: " + JSON.stringify(err.message)) + } + }).key('buttonClick') }.height(400).padding({ left: 35, right: 35, top: 35 }) } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas.ets index d342b09be2f72364b514c64ef2c29fbf37e8fc8f..ea4f5bd8a48219c0a23f769187415cd9ffe4bb77 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,8 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' - @Entry @Component struct CanvasExample { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas2.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas2.ets index 81636715974dec07cfd9b7c54fba3d1182ab78d5..d8bed84410da0f12e3c1e9b9833bb2d9a0bf578f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/canvas2.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,8 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' - @Entry @Component struct Canvas2Example { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/circle.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/circle.ets index 364aa0e4ba301af16d95727d174941b2f5e28ad1..be8adf01e138b31806692fb0c851d80b1814402b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/circle.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct CircleExample { @@ -22,7 +23,7 @@ struct CircleExample { onPageShow() { console.info('[circle] page show called'); var stateChangeEvent = { - eventId: 455, + eventId: 77, priority: events_emitter.EventPriority.LOW } console.info('[circle] page show calledA'); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridPage.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/gridPage.ets similarity index 89% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridPage.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/gridPage.ets index d39141a797870bf93924dd858e4792a4b34ddff2..b751d110592174b0147acae606a0fa0813e9c6e7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridPage.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/gridPage.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -93,29 +93,24 @@ struct gridPage { onPageShow() { console.info('button page show called'); var stateChangeEvent = { - eventId: 1001, + eventId: 110, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEvent2 = { - eventId: 1002, + eventId: 111, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent2, this.stateChangCallBack) var stateChangeEvent3 = { - eventId: 1003, + eventId: 112, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent3, this.stateChangCallBack) var stateChangeEvent4 = { - eventId: 1004, + eventId: 113, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent4, this.stateChangCallBack) - var stateChangeEvent5 = { - eventId: 1005, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent5, this.stateChangCallBack) } } \ No newline at end of file diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..a9c75c7154b8b5d6f5f76b1cf05cff275d4386f4 --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +// @ts-nocheck +/** + * 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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/line.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/line.ets index ca32685ae7a6029569c16d964d2a834108fa55f3..f076af847697114279a039f2f144954e6049bd71 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/line.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -48,7 +48,7 @@ struct LineExample { onPageShow() { console.info('line page show called'); var stateChangeEvent = { - eventId: 233, + eventId: 131, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/longPressGesture.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/longPressGesture.ets index 647bd32e210b162a80303834293b0f54d902f498..8f5a50f9f1f0810c3e080612cfd605362631611c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/longPressGesture.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -39,7 +39,7 @@ struct LongPressGestureExample { } } let backEvent = { - eventId: 38, + eventId: 125, priority: events_emitter.EventPriority.LOW } console.info("start to emit action state"); @@ -59,7 +59,7 @@ struct LongPressGestureExample { } } let backEvent = { - eventId: 39, + eventId: 126, priority: events_emitter.EventPriority.LOW } console.info("start to emit action state"); @@ -73,6 +73,4 @@ struct LongPressGestureExample { }) ) } - onPageShow() { - } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/motionPath.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/motionPath.ets index 18ae81be9b4e335d1c2644929a14c9154af796fe..0ef8f33d2997f1abf476865cfcc216d95c3890da 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/motionPath.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -40,7 +41,7 @@ struct MotionPathExample { } } var backEvent = { - eventId: 2, + eventId: 132, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") @@ -64,7 +65,7 @@ struct MotionPathExample { } } var backEvent = { - eventId: 3, + eventId: 133, priority: events_emitter.EventPriority.LOW } console.info("button1 position start to emit action state") @@ -81,7 +82,7 @@ struct MotionPathExample { onPageShow(){ console.info('motionPath page show called'); var stateChangeEvent = { - eventId:1, + eventId:134, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent,this.stateChangeCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/parallelGesture.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/parallelGesture.ets index 0e4de743f78d77f686ee2b53f23d315366094311..8b8151cc00e562dc8483f18d4d89f87c0f75f07f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/parallelGesture.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -31,7 +31,7 @@ struct GestureSettingsExample { } } var backEvent = { - eventId: 199, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/priorityGesture.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/priorityGesture.ets index c37975d2ffe196464b89a29e7c80b6999e5d5f3e..e96f32efb1ff53cbae17cc8998c4acda65f00bca 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/priorityGesture.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -31,7 +31,7 @@ struct GestureSettingsExample { } } var backEvent = { - eventId: 111, + eventId: 162, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/progress.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/progress.ets index 8b18e95fce4faef4a8e20e56e5f5fddae347b54c..b5c05681f18f9405f049039a22a20ed81cfc10cb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/progress.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,8 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' - +import events_emitter from '@ohos.emitter' @Entry @Component @@ -39,37 +39,37 @@ struct ProgressExample { onPageShow() { console.info('progress page show called'); var stateChangeEvent = { - eventId: 55, + eventId: 164, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 44, + eventId: 165, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 43, + eventId: 166, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) var stateChangeEventFour = { - eventId: 42, + eventId: 167, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventFour, this.stateChangCallBack) var stateChangeEventFive = { - eventId: 41, + eventId: 168, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventFive, this.stateChangCallBack) var stateChangeEventSix = { - eventId: 40, + eventId: 169, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventSix, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/rating.ets similarity index 85% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/rating.ets index 3537f959838d472277fe898eee9e556d494a1aab..fc4ae6d4d6f1ad604ba9c2b2a7f78a5e5ada775d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/rating.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -35,43 +36,37 @@ struct RatingExample { onPageShow() { console.info('rating page show called'); var stateChangeEvent = { - eventId: 440, + eventId: 173, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 441, + eventId: 174, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 442, + eventId: 175, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) var stateChangeEventFour = { - eventId: 443, + eventId: 176, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventFour, this.stateChangCallBack) - var stateChangeEventFive = { - eventId: 444, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEventFive, this.stateChangCallBack) - var stateChangeEventSix = { - eventId: 444, + eventId: 177, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventSix , this.stateChangCallBack) var stateChangeEventSeven = { - eventId: 445, + eventId: 178, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventSeven , this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets similarity index 90% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets index b835c9f936fb546d4d0c46e31e15f83c15401cd6..3092b5e4e5cb0bc82995dd18516a52c86606c701 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/scrollCode.ets @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component struct scrollCode { - @State scrollable: ScrollDirection = ScrollDirection.None; + @State scrollable: ScrollDirection = ScrollDirection.Vertical; @State scrollBar: BarState = BarState.On; @State scrollBarColor: Color = "#FF0000FF"; @State scrollBarWidth: number = 30; @@ -70,25 +70,25 @@ struct scrollCode { onPageShow() { console.info('scrollCode page show called'); var stateChangeEvent = { - eventId: 90, + eventId: 185, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 80, + eventId: 186, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 85, + eventId: 187, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 95, + eventId: 188, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -129,19 +129,17 @@ struct scrollCode { this.scroller.scrollEdge(Edge.Top) }) .margin({ top: 120, left: 20 }) - Button('next page').backgroundColor(0x2788D9).width(200).height(100).fontSize(20) + Button('next page').backgroundColor(0x2788D9).fontSize(20) .onClick((event: ClickEvent) => { this.onClickValue = true; try { var backData = { data: { "scrollToIndex": 10, - "ACTION": this.onClickValue, - "event": JSON.stringify(event) } } var backEvent = { - eventId: 30, + eventId: 189, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/shape.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/shape.ets index 95ac6e2f15ad8692e93c64967ad3faf120defe41..2a1ecb9d80241be4b99463c3a6308e1ee9ca4693 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/shape.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -71,7 +71,7 @@ struct ShapeExample { onPageShow() { console.info('qrCode page show called'); var stateChangeEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition.ets index 3a31b9ad26643f85b66017677212edba829f7114..83bd6c36762b2a49969c6861850f9112a885200b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -46,7 +47,7 @@ struct SharedTransitionExample { } } var backEvent = { - eventId: 556, + eventId: 193, priority: events_emitter.EventPriority.LOW } console.info("SharedTransition start to emit action state") @@ -64,7 +65,7 @@ struct SharedTransitionExample { onPageShow() { console.info('sharedTransition page show called'); var stateChangeEvent = { - eventId: 555, + eventId: 194, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets similarity index 91% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets index 88253ee621004879f268499ed557ac2d97238b5b..84760f7ca328acfc537b2cc91da4b442805e164d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,8 +14,6 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' - @Entry @Component struct SharedTransition2Example { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/span.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/span.ets index d4d1159abf9e383d06d4f796b1347a1da8f8baa0..e51f96b9c48604530ee5bcbf03fbbbaa669598a2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/span.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -41,19 +41,19 @@ struct SpanExample { onPageShow() { console.info('span page show called'); var stateChangeEvent = { - eventId: 40, + eventId: 199, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent2 = { - eventId: 41, + eventId: 200, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent2, this.stateChangCallBack); var stateChangeEvent3 = { - eventId: 42, + eventId: 201, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent3, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tabs.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tabs.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tabs.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tabs.ets index de1b62789d04a7bbcd275625a41e223841cb3a67..0d656f0583a583b2c90e09ae12b6e138ff31fbe8 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tabs.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tabs.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -44,7 +45,7 @@ struct TabsExample { } } var backEvent = { - eventId: 88, + eventId: 212, priority: events_emitter.EventPriority.LOW } console.info("tabContent1 start to emit action state") @@ -84,7 +85,7 @@ struct TabsExample { onPageShow() { console.info('tabs page show called'); var stateChangeEvent = { - eventId: 87, + eventId: 213, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tapGesture.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tapGesture.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tapGesture.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tapGesture.ets index b57f0113e1656946ba26cfa38776616082d82a89..d920ce9c3a4aa9262b28a034723cfba383706b5c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tapGesture.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/tapGesture.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -39,7 +40,7 @@ struct TapGestureExample { } } var backEvent = { - eventId: 82, + eventId: 214, priority: events_emitter.EventPriority.LOW } console.info("click to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets index fc4612abcadd8c819d06d9c4307cbe900ebb3b71..0af6246fd1a12803251a6ccee18fc7b69848da83 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/text.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -42,25 +43,25 @@ struct TextExample { onPageShow() { console.info('text page show called'); var stateChangeEvent = { - eventId: 60, + eventId: 226, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { - eventId: 198, + eventId: 227, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) var stateChangeEventTwo = { - eventId: 127, + eventId: 228, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) var stateChangeEventThree = { - eventId: 129, + eventId: 229, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/timeStamp.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/timeStamp.ets index 8eda4ca7702f73fa0891c54c325220a532ebb8a9..2ee08aac738b06e6f4d02296aae852d00414314d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/timeStamp.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' + @Entry @Component struct ClickExample { @@ -32,7 +33,7 @@ struct ClickExample { } } var backEvent = { - eventId: 235, + eventId: 230, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/toggle.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/toggle.ets index a15d440a2b0e0656bf90c3b23e3fe9021a5b71a0..0380421b5753bb17cb24e1917125dcb3c88a42e1 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/toggle.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -25,13 +25,13 @@ struct ToggleExample { onPageShow() { console.info('[toggle] page show called'); var stateChangeEvent = { - eventId: 1011, + eventId: 231, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEventOne = { - eventId: 1012, + eventId: 232, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/transition.ets similarity index 91% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/transition.ets index 5ba4b35356ec70ee11494e9c4f8c6b7edd0b199c..00f32a24478e9c9a663708b9394877c56f0320d2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/transition.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -23,6 +24,7 @@ struct TransitionExample { @State onActionCalled: boolean = false @State transitionTypeOne: TransitionType = TransitionType.Insert @State transitionTypeTwo: TransitionType = TransitionType.Delete + @State transitionTypeThree: TransitionType = TransitionType.All build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) { @@ -36,7 +38,7 @@ struct TransitionExample { } } var backEvent = { - eventId: 333, + eventId: 233, priority: events_emitter.EventPriority.LOW } console.info("transitionTest_0200 start to emit action state") @@ -65,7 +67,7 @@ struct TransitionExample { onPageShow() { console.info('transition page show called'); var stateChangeEvent = { - eventId: 112, + eventId: 234, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets index 315d4ed1cf0f74b75c1783a639f6fc9b514a7d4e..7b68cd33a130bec2423543b4b166d0b92afec909 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets @@ -54,7 +54,7 @@ export default function aboutToDisappearJsunit() { expect(indexEvent.data.ACTION).assertEqual(false); } let indexEvent = { - eventId: 160, + eventId: 49, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets index 1d02d8038133f55e7541db2457db029e565105ea..05684cc3352af0e5f17dfe00eeeb5079e77533da 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets @@ -50,7 +50,7 @@ export default function animateJsunit() { console.info('animateTest_0100 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 60, + eventId: 51, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -72,7 +72,7 @@ export default function animateJsunit() { console.info('animateTest_0200 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 61, + eventId: 52, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -94,7 +94,7 @@ export default function animateJsunit() { console.info('animateTest_0300 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 62, + eventId: 53, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -116,7 +116,7 @@ export default function animateJsunit() { console.info('animateTest_0400 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 63, + eventId: 54, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -138,7 +138,7 @@ export default function animateJsunit() { console.info('animateTest_0500 START'); await Utils.sleep(1500); let indexEvent = { - eventId: 64, + eventId: 55, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -165,7 +165,7 @@ export default function animateJsunit() { } } let indexEventOne = { - eventId: 65, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("animateTest_0600 start to publish emit"); @@ -174,7 +174,7 @@ export default function animateJsunit() { console.log("animateTest_0600 change component data error: " + err.message); } let indexEvent = { - eventId: 60, + eventId: 51, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -201,7 +201,7 @@ export default function animateJsunit() { } } let indexEventOne = { - eventId: 65, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("animateTest_0700 start to publish emit"); @@ -210,7 +210,7 @@ export default function animateJsunit() { console.log("animateTest_0700 change component data error: " + err.message); } let indexEvent = { - eventId: 61, + eventId: 52, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -237,7 +237,7 @@ export default function animateJsunit() { } } let indexEventOne = { - eventId: 65, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("animateTest_0800 start to publish emit"); @@ -246,7 +246,7 @@ export default function animateJsunit() { console.log("animateTest_0800 change component data error: " + err.message); } let indexEvent = { - eventId: 62, + eventId: 53, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -273,7 +273,7 @@ export default function animateJsunit() { } } let indexEventOne = { - eventId: 65, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("animateTest_0900 start to publish emit"); @@ -282,7 +282,7 @@ export default function animateJsunit() { console.log("animateTest_0900 change component data error: " + err.message); } let indexEvent = { - eventId: 63, + eventId: 54, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { @@ -309,7 +309,7 @@ export default function animateJsunit() { } } let indexEventOne = { - eventId: 65, + eventId: 50, priority: events_emitter.EventPriority.LOW } console.info("animateTest_1000 start to publish emit"); @@ -318,7 +318,7 @@ export default function animateJsunit() { console.log("animateTest_1000 change component data error: " + err.message); } let indexEvent = { - eventId: 64, + eventId: 55, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BackgroundJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BackgroundJsunit.test.ets index 598b9ec32078a198f759047db2e431c18af44e2b..e136b080ba3c59cde6093bc69631f1275b947e79 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BackgroundJsunit.test.ets @@ -16,7 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import events_emitter from '@ohos.events.emitter' -import Utils from '../Utils.ets'; +import Utils from './Utils.ets'; export default function backgroundJsunit() { describe('backgroundTest', function () { @@ -68,7 +68,7 @@ export default function backgroundJsunit() { } } var innerEvent = { - eventId: 281, + eventId: 2, priority: events_emitter.EventPriority.LOW } console.info("testBackground_0200 start pages"); @@ -92,7 +92,7 @@ export default function backgroundJsunit() { console.info("testBackground_0300 component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("testBackground_0300 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderWidth).assertEqual("1.000000vp"); + expect(obj.$attrs.borderWidth).assertEqual("1.00vp"); console.info('testBackground_0300 END'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets index aca8b7f8a532735fd16b8f81f7396f94adfbd24f..162aebd0f659a4f2820c844028a5b19ea9ac64c4 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets @@ -55,7 +55,7 @@ export default function badgeJsunit() { console.info("[testBadge01] component obj is: " + JSON.stringify(obj)); let style = JSON.parse(obj.$attrs.style); expect(obj.$type).assertEqual('Badge'); - expect(style.fontSize).assertEqual('20.000000fp'); + expect(style.fontSize).assertEqual('20.00fp'); done(); }); @@ -69,7 +69,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge02] start to publish emit"); @@ -82,7 +82,7 @@ export default function badgeJsunit() { let objNew = JSON.parse(strJsonNew); console.info("[testBadge02] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); - expect(style.fontSize).assertEqual('30.000000fp'); + expect(style.fontSize).assertEqual('30.00fp'); done(); }); @@ -96,7 +96,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge03] start to publish emit"); @@ -109,7 +109,7 @@ export default function badgeJsunit() { let objNew = JSON.parse(strJsonNew); console.info("[testBadge03] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); - expect(style.fontSize).assertEqual('-1.000000fp'); + expect(style.fontSize).assertEqual('-1.00fp'); done(); }); @@ -123,7 +123,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge04] start to publish emit"); @@ -136,7 +136,7 @@ export default function badgeJsunit() { let objNew = JSON.parse(strJsonNew); console.info("[testBadge04] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); - expect(style.fontSize).assertEqual('121212121.000000fp'); + expect(style.fontSize).assertEqual('121212121.00fp'); done(); }); @@ -150,7 +150,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge05] start to publish emit"); @@ -164,7 +164,7 @@ export default function badgeJsunit() { console.info("[testBadge05] component objNew is: " + JSON.stringify(objNew)); let style = JSON.parse(objNew.$attrs.style); console.info("[testBadge05] component style is: " + JSON.stringify(style)); - expect(style.fontSize).assertEqual('121212121.000000fp'); + expect(style.fontSize).assertEqual('121212121.00fp'); done(); }); @@ -201,7 +201,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge08] start to publish emit"); @@ -228,7 +228,7 @@ export default function badgeJsunit() { } } var innerEvent = { - eventId: 70, + eventId: 63, priority: events_emitter.EventPriority.LOW } console.info("[testBadge09] start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets index 757c4a6c75dd8a36169ef5d3d8e88200ebb0df29..c578e6fb462dd52e54cb01897bada1b8ce07caaa 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets @@ -55,7 +55,7 @@ export default function blankJsunit() { console.info("[testBlank01] component obj is: " + JSON.stringify(obj)); expect(obj.$type).assertEqual('Blank'); expect(obj.$attrs.color).assertEqual('#FF0000FF'); - expect(obj.$attrs.min).assertEqual('0.000000px'); + expect(obj.$attrs.min).assertEqual('0.00px'); done(); }); @@ -69,7 +69,7 @@ export default function blankJsunit() { } } var innerEvent = { - eventId: 90, + eventId: 69, priority: events_emitter.EventPriority.LOW } console.info("[testBlank02] start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets similarity index 79% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets index 60b4a60d143577c954e16da0fbd6c294705d1170..fa28d684d982267cc558d98d4d07fe8c1c1c1724 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets @@ -85,7 +85,7 @@ export default function buttonJsunit() { let strJson = getInspectorByKey('button3'); let obj = JSON.parse(strJson); console.info("[testButton04] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.borderColor).assertEqual(Color.black); + expect(obj.$attrs.borderColor).assertEqual('#FF000000'); done(); }); @@ -99,7 +99,7 @@ export default function buttonJsunit() { } } var innerEvent = { - eventId: 80, + eventId: 70, priority: events_emitter.EventPriority.LOW } console.info("[testButton05] start to publish emit"); @@ -121,11 +121,11 @@ export default function buttonJsunit() { try { var eventData = { data: { - "fontSizeValue": "30", + "fontSizeValue": 30, } } var innerEvent = { - eventId: 81, + eventId: 70, priority: events_emitter.EventPriority.LOW } console.info("[testButton06] start to publish emit"); @@ -141,34 +141,34 @@ export default function buttonJsunit() { done(); }); - it('testButton06', 0, async function (done) { - console.info('[testButton06] START'); + it('testButton07', 0, async function (done) { + console.info('[testButton07] START'); await Utils.sleep(1000); try { var eventData = { data: { - "fontSizeValue": "-1", + "fontSizeValue": -1, } } var innerEvent = { - eventId: 81, + eventId: 70, priority: events_emitter.EventPriority.LOW } - console.info("[testButton06] start to publish emit"); + console.info("[testButton07] start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testButton06] change component data error: " + err.message); + console.log("[testButton07] change component data error: " + err.message); } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); - console.info("[testButton06] component objNew is: " + JSON.stringify(objNew)); + console.info("[testButton07] component objNew is: " + JSON.stringify(objNew)); expect(objNew.$attrs.fontSize).assertEqual('0'); done(); }); - it('testButton07', 0, async function (done) { - console.info('[testButton07] START'); + it('testButton08', 0, async function (done) { + console.info('[testButton08] START'); await Utils.sleep(1000); try { var eventData = { @@ -177,24 +177,24 @@ export default function buttonJsunit() { } } var innerEvent = { - eventId: 81, + eventId: 70, priority: events_emitter.EventPriority.LOW } - console.info("[testButton07] start to publish emit"); + console.info("[testButton08] start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testButton07] change component data error: " + err.message); + console.log("[testButton08] change component data error: " + err.message); } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); - console.info("[testButton07] component objNew is: " + JSON.stringify(objNew)); + console.info("[testButton08] component objNew is: " + JSON.stringify(objNew)); expect(objNew.$attrs.fontSize).assertEqual('121212121'); done(); }); - it('testButton08', 0, async function (done) { - console.info('[testButton08] START'); + it('testButton09', 0, async function (done) { + console.info('[testButton09] START'); await Utils.sleep(1000); try { var eventData = { @@ -203,24 +203,24 @@ export default function buttonJsunit() { } } var innerEvent = { - eventId: 81, + eventId: 70, priority: events_emitter.EventPriority.LOW } - console.info("[testButton08] start to publish emit"); + console.info("[testButton09] start to publish emit"); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testButton08] change component data error: " + err.message); + console.log("[testButton09] change component data error: " + err.message); } await Utils.sleep(2000); let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); - console.info("[testButton08] component objNew is: " + JSON.stringify(objNew)); + console.info("[testButton09] component objNew is: " + JSON.stringify(objNew)); expect(objNew.$attrs.fontSize).assertEqual('121212121'); done(); }); - it('testButton09', 0, async function (done) { - console.info('[testButton09] START'); + it('testButton10', 0, async function (done) { + console.info('[testButton10] START'); try { let eventData = { data: { @@ -228,36 +228,36 @@ export default function buttonJsunit() { } } let indexEventOne = { - eventId: 80, + eventId: 70, priority: events_emitter.EventPriority.LOW } - console.info("testButton09 start to publish emit"); + console.info("testButton10 start to publish emit"); events_emitter.emit(indexEventOne, eventData); } catch (err) { - console.log("testButton09 change component data error: " + err.message); + console.log("testButton10 change component data error: " + err.message); } await Utils.sleep(1000); let indexEvent = { - eventId: 159, + eventId: 72, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { - console.info("testButton09 get state result is: " + JSON.stringify(indexEvent)) + console.info("testButton10 get state result is: " + JSON.stringify(indexEvent)) except(indexEvent.data.fontColorValue).assertEqual(Color.Pink) } try { events_emitter.on(indexEvent, callback); } catch (err) { - console.info("testButton09 on events_emitter err : " + JSON.stringify(err)); + console.info("testButton10 on events_emitter err : " + JSON.stringify(err)); } - console.info("testButton09 click result is: " + JSON.stringify(sendEventByKey('button3',10 ,""))); + console.info("testButton10 click result is: " + JSON.stringify(sendEventByKey('button3',10 ,""))); await Utils.sleep(1000); - console.info('[testButton09] END'); + console.info('[testButton10] END'); done(); }); - it('testButton10', 0, async function (done) { - console.info('[testButton10] START'); + it('testButton11', 0, async function (done) { + console.info('[testButton11] START'); try { let eventData = { data: { @@ -265,31 +265,57 @@ export default function buttonJsunit() { } } let indexEventOne = { - eventId: 80, + eventId: 70, priority: events_emitter.EventPriority.LOW } - console.info("testButton10 start to publish emit"); + console.info("testButton11 start to publish emit"); events_emitter.emit(indexEventOne, eventData); } catch (err) { - console.log("testButton10 change component data error: " + err.message); + console.log("testButton11 change component data error: " + err.message); } await Utils.sleep(1000); let indexEvent = { - eventId: 160, + eventId: 71, priority: events_emitter.EventPriority.LOW } let callback= (indexEvent) => { - console.info("testButton10 get state result is: " + JSON.stringify(indexEvent)) + console.info("testButton11 get state result is: " + JSON.stringify(indexEvent)) except(indexEvent.data.fontColorValue).assertEqual(332) } try { events_emitter.on(indexEvent, callback); } catch (err) { - console.info("testButton10 on events_emitter err : " + JSON.stringify(err)); + console.info("testButton11 on events_emitter err : " + JSON.stringify(err)); } - console.info("testButton10 click result is: " + JSON.stringify(sendEventByKey('button2',10 ,""))); + console.info("testButton11 click result is: " + JSON.stringify(sendEventByKey('button2',10 ,""))); await Utils.sleep(1000); - console.info('[testButton10] END'); + console.info('[testButton11] END'); + done(); + }); + + it('testButton12', 0, async function (done) { + await Utils.sleep(1000); + var callback = (eventData) => { + console.info("[testButton12] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true) + let event = JSON.parse(eventData.data.event); + expect(event.screenX).assertEqual(135) + expect(event.screenY).assertEqual(368.80340576171875) + expect(event.x).assertEqual(100) + expect(event.y).assertEqual(31.196568154881163) + } + var innerEvent = { + eventId: 4, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testButton12] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testButton12] sendEventByKey ' + JSON.stringify(sendEventByKey('buttonClick', 10, ""))); + await Utils.sleep(1000) + console.info('[testButton12] testSendTouchEvent END'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets similarity index 100% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets index 669e5199ce85205de0cbe6d9a6fb199cac3d51ad..75458152d636d328f1c6050b5b2a1a087b221d45 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets @@ -68,7 +68,7 @@ export default function circleJsunit() { } console.info('[circleTest_0200] START'); var innerEvent = { - eventId:455, + eventId:77, priority: events_emitter.EventPriority.LOW } console.info("[circleTest_0200] start to publish emit"); @@ -97,7 +97,7 @@ export default function circleJsunit() { } console.info('[circleTest_0300] START'); var innerEvent = { - eventId:455, + eventId:77, priority: events_emitter.EventPriority.LOW } console.info("[circleTest_0300] start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets index 960348eee06a432f678c9f4ddf173db35032bb9e..1f5fecda9434e1a48afd926d9f8bc5ce22a5681e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets @@ -142,7 +142,7 @@ export default function commonJsunit() { var a = 50; var b = lpx2px(a); console.info('commonTest_1300 lpx2px result:' + b); - expect(b == 33).assertTrue(); + expect(b == 50).assertTrue(); console.info('commonTest_1300 END'); done(); }); @@ -152,7 +152,7 @@ export default function commonJsunit() { var a = -500000000; var b = lpx2px(a); console.info('commonTest_1400 lpx2px result:' + b); - expect(b == -333333343).assertTrue(); + expect(b == -500000000).assertTrue(); console.info('commonTest_1400 END'); done(); }); @@ -172,7 +172,7 @@ export default function commonJsunit() { var a = 40; var b = px2lpx(a); console.info('commonTest_1600 px2lpx result:' + b); - expect(b == 59.99999821186071).assertTrue(); + expect(b == 40).assertTrue(); console.info('commonTest_1600 END'); done(); }); @@ -182,7 +182,7 @@ export default function commonJsunit() { var a = -400000; var b = px2lpx(a); console.info('commonTest_1700 px2lpx result:' + b); - expect(b == -599999.9821186071).assertTrue(); + expect(b == -400000).assertTrue(); console.info('commonTest_1700 END'); done(); }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets index f1bebad7f6ab91b14d30bcb7c24f12389486d756..a29298f462660c8bed559dc3a07cf011f75415ee 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets @@ -46,14 +46,13 @@ export default function gridJsunit() { console.info('[ afterEach ] ===================grid test after each called==================='); }); - // columnsGap it('gridTest01', 0, async function (done) { console.info('gridTest01==================== start'); await Utils.sleep(1000) let strJson = getInspectorByKey('grid'); let obj = JSON.parse(strJson); console.info('gridTest01 all attribute before change is: ' + JSON.stringify(obj.$attrs.columnsGap)); - expect(obj.$attrs.columnsGap).assertEqual('2.000000px') + expect(obj.$attrs.columnsGap).assertEqual('2.00px') try { var eventData = { data: { @@ -61,7 +60,7 @@ export default function gridJsunit() { } } var innerEvent = { - eventId: 1001, + eventId: 110, priority: events_emitter.EventPriority.LOW } console.info('gridTest01 start to publish emit') @@ -73,19 +72,18 @@ export default function gridJsunit() { let strJsonAfterChange = getInspectorByKey('grid'); let objAfterChange = JSON.parse(strJsonAfterChange); console.info('gridTest01 columnsGap attribute after change is: ' + JSON.stringify(objAfterChange.$attrs.columnsGap)); - expect(objAfterChange.$attrs.columnsGap).assertEqual('3.000000px') + expect(objAfterChange.$attrs.columnsGap).assertEqual('3.00px') console.info('[gridTest01] ==================== end'); done(); }); - // rowsGap test it('gridTest02', 0, async function (done) { console.info('[ gridTest02 ] ==================== start'); await Utils.sleep(1000) let strJson = getInspectorByKey('grid'); let obj = JSON.parse(strJson); console.info('[ gridTest02 ] attribute rowsGap before change is: ' + JSON.stringify(obj.$attrs.rowsGap)); - expect(obj.$attrs.rowsGap).assertEqual('2.000000px') + expect(obj.$attrs.rowsGap).assertEqual('2.00px') try { var eventData = { data: { @@ -93,7 +91,7 @@ export default function gridJsunit() { } } var innerEvent = { - eventId: 1002, + eventId: 111, priority: events_emitter.EventPriority.LOW } console.info('[ gridTest02 ] start to publish emit') @@ -105,12 +103,11 @@ export default function gridJsunit() { let strJsonAfterChange = getInspectorByKey('grid'); let objAfterChange = JSON.parse(strJsonAfterChange); console.info('[ gridTest02 ] attribute rowsGap after change is: ' + JSON.stringify(objAfterChange.$attrs.rowsGap)); - expect(objAfterChange.$attrs.rowsGap).assertEqual('3.000000px') + expect(objAfterChange.$attrs.rowsGap).assertEqual('3.00px') console.info('[ gridTest02 ] ==================== end'); done(); }); - // columnsTemplate test it('gridTest03', 0, async function (done) { console.info('[ gridTest03 ] ==================== start'); await Utils.sleep(1000) @@ -125,7 +122,7 @@ export default function gridJsunit() { } } var innerEvent = { - eventId: 1003, + eventId: 112, priority: events_emitter.EventPriority.LOW } console.info('[ gridTest03 ] start to publish emit') @@ -142,7 +139,6 @@ export default function gridJsunit() { done(); }); - // rowsTemplate test it('gridTest04', 0, async function (done) { console.info('[ gridTest04 ] ==================== start'); await Utils.sleep(1000) @@ -157,7 +153,7 @@ export default function gridJsunit() { } } var innerEvent = { - eventId: 1004, + eventId: 113, priority: events_emitter.EventPriority.LOW } console.info('[ gridTest04 ] start to publish emit') @@ -173,6 +169,5 @@ export default function gridJsunit() { console.info('[ gridTest04 ] ==================== end'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets index 0523b7f8abb99a1dd2568710df4b5b25668b2f6a..52fb4eebefb0f96652efb8250633ad60b6be5374 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets @@ -31,7 +31,7 @@ export default function LineJsunit(){ if (!("line" == pages.name)) { console.info("get line state success " + JSON.stringify(pages.name)); let result = await router.push(options); - await Utils.sleep(1000); + await Utils.sleep(2000); console.info("push line page success " + JSON.stringify(result)); } } catch (err) { @@ -41,12 +41,13 @@ export default function LineJsunit(){ }); afterEach(async function () { - await Utils.sleep(1000); + await Utils.sleep(2000); console.info("line after each called"); }); it('lineTest_0100', 0, async function (done) { console.info('lineTest_0100 START'); + await Utils.sleep(2000); let strJson = getInspectorByKey('line'); console.info("lineTest_0100 component strJson:" + strJson); let obj = JSON.parse(strJson); @@ -96,7 +97,7 @@ export default function LineJsunit(){ } } var innerEvent = { - eventId: 233, + eventId: 131, priority: events_emitter.EventPriority.LOW } console.info("lineTest_0500 start to publish emit"); @@ -125,7 +126,7 @@ export default function LineJsunit(){ } } var innerEvent = { - eventId: 233, + eventId: 131, priority: events_emitter.EventPriority.LOW } console.info("lineTest_0600 start to publish emit"); @@ -154,7 +155,7 @@ export default function LineJsunit(){ } } var innerEvent = { - eventId: 233, + eventId: 131, priority: events_emitter.EventPriority.LOW } console.info("lineTest_0700 start to publish emit"); @@ -183,7 +184,7 @@ export default function LineJsunit(){ } } var innerEvent = { - eventId: 233, + eventId: 131, priority: events_emitter.EventPriority.LOW } console.info("lineTest_0800 start to publish emit"); diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..ef83463975232e833f45ff8bb544d04463a4a419 --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,77 @@ +/** + * 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 gridJsunit from './GridJsunit.test.ets'; +import canvasJsunit from './CanvasJsunit.test.ets'; +import textJsunit from './TextJsunit.test.ets'; +import badgeJsunit from './BadgeJsunit.test.ets'; +import longPressGestureJsUnit from './LongPressGesture.test.ets'; +import buttonJsunit from './ButtonJsunit.test.ets'; +import responseRegionJsunit from './ResponseRegionJsunit.test.ets'; +import panGestureJsunit from './PanGestureJsunit.test.ets'; +import tabsJsunit from './TabsJsunit.test.ets'; +import qrCodeJsunit from './QrCodeJsunit.test.ets'; +import tapGesture from './TapGesture.test.ets'; +import progressJsunit from './ProgressJsunit.test.ets'; +import animateJsunit from './AnimateJsunit.test.ets'; +import commonJsunit from './CommonJsunit.test.ets'; +import spanJsunit from './SpanJsunit.test.ets'; +import ratingJsunit from './RatingJsunit.test.ets'; +import canvas2Jsunit from './Canvas2Jsunit.test.ets'; +import toggleJsunit from './ToggleJsunit.test.ets'; +import shapeJsunit from './ShapeJsunit.test.ets'; +import motionPathJsunit from './MotionPathJsunit.test.ets'; +import scrollCodeJsunit from './ScrollCodeJsunit.test.ets'; +import transitionJsunit from './TransitionJsunit.test.ets'; +import priorityGestureJsunit from './PriorityGestureJsunit.test.ets'; +import parallelGestureJsunit from './ParallelGestureJsunit.test.ets'; +import blankJsunit from './BlankJsunit.test.ets'; +import sharedTransitionJsunit from './SharedTransitionJsunit.test.ets'; +import lineJsunit from './LineJsunit.test.ets'; +import circleJsunit from './CircleJsunit.test.ets'; +import aboutToDisappearJsunit from './AboutToDisappearJsunit.test.ets'; +import timeStampJsunit from './TimeStampJsunit.test.ets'; + +export default function testsuite() { + badgeJsunit(); + lineJsunit(); + progressJsunit(); + textJsunit(); + buttonJsunit(); + tabsJsunit(); + qrCodeJsunit(); + circleJsunit(); + gridJsunit(); + tapGesture(); + panGestureJsunit(); + canvasJsunit(); + canvas2Jsunit(); + longPressGestureJsUnit(); + responseRegionJsunit(); + animateJsunit(); + commonJsunit(); + spanJsunit(); + ratingJsunit(); + toggleJsunit(); + shapeJsunit(); + motionPathJsunit(); + scrollCodeJsunit(); + transitionJsunit(); + priorityGestureJsunit(); + parallelGestureJsunit(); + blankJsunit(); + sharedTransitionJsunit(); + aboutToDisappearJsunit(); + timeStampJsunit(); +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets index 18f49d43460765e1ab4dd48a97e16c288ef9ab27..84c9ae69bfe10dbc221e2c5117fafec05e7b254c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets @@ -54,7 +54,7 @@ export default function longPressGestureJsunit() { expect(eventData.data.ACTION).assertEqual('onAction') } let innerEvent = { - eventId: 38, + eventId: 125, priority: events_emitter.EventPriority.LOW } try { @@ -77,7 +77,7 @@ export default function longPressGestureJsunit() { expect(eventData.data.ACTION).assertEqual('onActionEnd') } let innerEvent = { - eventId: 39, + eventId: 126, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets index f4c56998d10064cb40e6f3bae175d28ce4e145e5..b7780ad73abcff7f61a3539659a0bfba3585d94e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets @@ -64,7 +64,7 @@ export default function motionPathJsunit() { expect(indexEventOne.data.toY).assertEqual(1); } let indexEventOne = { - eventId: 3, + eventId: 133, priority: events_emitter.EventPriority.LOW } try { @@ -86,7 +86,7 @@ export default function motionPathJsunit() { expect(indexEvent.data.ACTION).assertEqual(true); } let indexEvent = { - eventId: 2, + eventId: 132, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PanGestureJsunit.test.ets similarity index 70% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PanGestureJsunit.test.ets index 14c48b1050e44b972979adabffbbe4300b2600a2..e7c97d51b02872d1d20646b339e3ab3284ee5c06 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PanGestureJsunit.test.ets @@ -16,7 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils'; +import Utils from './Utils'; export default function PanGestureJsunit() { describe('appInfoTest', function () { @@ -26,7 +26,7 @@ export default function PanGestureJsunit() { beforeEach(async function (done) { console.info("PanGesture beforeEach start"); let options = { - uri: 'pages/general-properties/PanGesture', + uri: 'pages/PanGesture', } try { router.clear(); @@ -51,16 +51,6 @@ export default function PanGestureJsunit() { it('testPanGesture01', 0, async function (done) { console.info('[testPanGesture01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('PanGesture'); - let obj = JSON.parse(strJson); - console.info("[testPanGesture01] obj is: " + JSON.stringify(obj)); - console.info('[testPanGesture01] END'); - done(); - }); - - it('testPanGesture02', 0, async function (done) { - console.info('[testPanGesture02] START'); try { var eventData = { data: { @@ -68,50 +58,49 @@ export default function PanGestureJsunit() { } } var innerEvent = { - eventId: 140, + eventId: 23, priority: events_emitter.EventPriority.LOW } - console.info("[testPanGesture02] start to publish emit:" + JSON.stringify(eventData.data)); + console.info("[testPanGesture01] start to publish emit:" + JSON.stringify(eventData.data)); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testPanGesture02] change component data error: " + err.message); + console.log("[testPanGesture01] change component data error: " + err.message); } await Utils.sleep(1000); - console.info('[testPanGesture02] END'); + console.info('[testPanGesture01] END'); done(); }); - it('testPanGesture03', 0, async function (done) { + it('testPanGesture02', 0, async function (done) { let rect = await Utils.getComponentRect('PanGesture') - console.info("[testPanGesture03] rectInfo is " + JSON.stringify(rect)); + console.info("[testPanGesture02] rectInfo is " + JSON.stringify(rect)); x_value = rect.left + (rect.right - rect.left) / 10 y_value = rect.top + (rect.bottom - rect.top) / 10 - console.info("[testPanGesture03] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); + console.info("[testPanGesture02] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); let point: TouchObject = { id: 1, x: x_value, y: y_value, type: TouchType.Move, } - var callbackTwo = (eventData) => { - console.info("[testPanGesture03] get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true) - expect(eventData.data.EVENT_TYPE).assertEqual('Move') + var callbackTwo = (eventDataOne) => { + console.info("[testPanGesture02] get event state result is: " + JSON.stringify(eventDataOne)); + expect(eventDataOne.data.ACTION).assertEqual(true) + expect(eventDataOne.data.EVENT_TYPE).assertEqual('Move') } var innerEventTwo = { - eventId: 85, + eventId: 24, priority: events_emitter.EventPriority.LOW } try { events_emitter.on(innerEventTwo, callbackTwo) } catch (err) { - console.info("[testPanGesture03] on events_emitter err : " + JSON.stringify(err)); + console.info("[testPanGesture02] on events_emitter err : " + JSON.stringify(err)); } - console.info('[testPanGesture03] testSendTouchEvent ' + sendTouchEvent(point)); + console.info('[testPanGesture02] testSendTouchEvent ' + sendTouchEvent(point)); await Utils.sleep(1000) - console.info('[testPanGesture03] END'); + console.info('[testPanGesture02] END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets index 5f0851e1c7deaa08f22af4f3b2c1342985fb722d..e0c2ee2fe858d12d04a24393e1f90c67bfd66257 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets @@ -59,7 +59,7 @@ export default function parallelGestureJsunit() { expect(eventData.data.value).assertEqual('gesture onAction') } var innerEvent = { - eventId: 199, + eventId: 150, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets index e2f2300440636d3280cf7871d93e4402d4f87856..b6284724b21ce39f98091f2470ab24424f24367b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets @@ -58,7 +58,7 @@ export default function priorityGestureJsunit() { expect(eventData.data.value).assertEqual('gesture onAction') } var innerEvent = { - eventId: 111, + eventId: 162, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets index fd828a97a6aeef27e0a3a875e8bb3efe3f8112b8..6ba9c00a4df2b2cb716ad423997f60219fc370a3 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets @@ -31,7 +31,7 @@ export default function progressJsunit() { if (!("progress" == pages.name)) { console.info("get progress state success " + JSON.stringify(pages.name)); let result = await router.push(options); - await Utils.sleep(4000); + await Utils.sleep(2000); console.info("push progress page success " + JSON.stringify(result)); } } catch (err) { @@ -41,16 +41,16 @@ export default function progressJsunit() { }); afterEach(async function () { - await Utils.sleep(1000); + await Utils.sleep(2000); console.info("progress after each called"); }); it('testProgress_100', 0, async function (done) { console.info('testProgress_100 START'); + await Utils.sleep(1000); let strJson1 = getInspectorByKey('LPValue'); let objLP = JSON.parse(strJson1); console.info("testProgress_100 component objLP is: " + objLP.$attrs.value); - await Utils.sleep(1000); try { let eventData = { data: { @@ -58,7 +58,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 55, + eventId: 164, priority: events_emitter.EventPriority.LOW } console.info("testProgress_100 start to publish emit"); @@ -69,7 +69,7 @@ export default function progressJsunit() { await Utils.sleep(2000); let strJson = getInspectorByKey('LPValue'); let obj = JSON.parse(strJson); - console.info("testProgress_100 component obj is: " + JSON.stringify(obj)); + console.info("testProgress_100 component obj is: " + JSON.stringify(obj.$attrs.value)); expect(obj.$attrs.value).assertEqual("100.000000"); console.info('testProgress_100 END'); done(); @@ -81,7 +81,7 @@ export default function progressJsunit() { let strJson = getInspectorByKey('LPValue'); let obj = JSON.parse(strJson); console.info("testProgress_200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("200.000000vp"); + expect(obj.$attrs.width).assertEqual("200.00vp"); console.info('testProgress_200 END'); done(); }); @@ -99,7 +99,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 44, + eventId: 165, priority: events_emitter.EventPriority.LOW } console.info("testProgress_300 start to publish emit"); @@ -122,7 +122,7 @@ export default function progressJsunit() { let strJson = getInspectorByKey('LPValue'); let obj = JSON.parse(strJson); console.info("testProgress_400 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("200.000000vp"); + expect(obj.$attrs.width).assertEqual("200.00vp"); console.info('testProgress_400 END'); done(); }); @@ -140,7 +140,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 43, + eventId: 166, priority: events_emitter.EventPriority.LOW } console.info("testProgress_500 start to publish emit"); @@ -163,7 +163,7 @@ export default function progressJsunit() { let strJson = getInspectorByKey('CPValue'); let obj = JSON.parse(strJson); console.info("testProgress_600 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("100.000000vp"); + expect(obj.$attrs.width).assertEqual("100.00vp"); console.info('testProgress_600 END'); done(); }); @@ -181,7 +181,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 42, + eventId: 167, priority: events_emitter.EventPriority.LOW } console.info("testProgress_700 start to publish emit"); @@ -211,7 +211,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 41, + eventId: 168, priority: events_emitter.EventPriority.LOW } console.info("testProgress_800 start to publish emit"); @@ -241,7 +241,7 @@ export default function progressJsunit() { } } var innerEvent = { - eventId: 40, + eventId: 169, priority: events_emitter.EventPriority.LOW } console.info("testProgress_900 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets index 4d85bdc8088235d56a1d5d55471dbc3751e5caff..5056a38ab35815b9e68422bc2f4dbbe7a0dac2cb 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets @@ -67,7 +67,7 @@ export default function qrCodeJsunit() { } } var innerEvent = { - eventId: 90, + eventId: 170, priority: events_emitter.EventPriority.LOW } console.info("[test_qrCode_002] start to publish emit"); @@ -93,7 +93,7 @@ export default function qrCodeJsunit() { } } var innerEvent = { - eventId: 80, + eventId: 171, priority: events_emitter.EventPriority.LOW } console.info("[test_qrCode_003] start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets index 92a5b1a42e953321fc899b12e2172f4d13f624fc..29a6bc8bea2c50eb40f74ad838c8355e5efb5d67 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +55,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 440, + eventId: 173, priority: events_emitter.EventPriority.LOW } console.info("testRating_100 start to publish emit"); @@ -92,7 +93,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 441, + eventId: 174, priority: events_emitter.EventPriority.LOW } console.info("testRating_300 start to publish emit"); @@ -120,7 +121,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 442, + eventId: 175, priority: events_emitter.EventPriority.LOW } console.info("testRating_400 start to publish emit"); @@ -147,7 +148,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 443, + eventId: 176, priority: events_emitter.EventPriority.LOW } console.info("testRating_500 start to publish emit"); @@ -174,7 +175,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 444, + eventId: 177, priority: events_emitter.EventPriority.LOW } console.info("testRating_600 start to publish emit"); @@ -201,7 +202,7 @@ export default function ratingJsunit() { } } var innerEvent = { - eventId: 445, + eventId: 178, priority: events_emitter.EventPriority.LOW } console.info("testRating_700 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ResponseRegionJsunit.test.ets similarity index 75% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ResponseRegionJsunit.test.ets index 229dc97ce12a630ab1a2dc75e6444db4fa9b21be..4f5092e56dda0aa00375f97c1773d24685bb2460 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ResponseRegionJsunit.test.ets @@ -16,7 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; import events_emitter from '@ohos.events.emitter'; -import Utils from '../Utils'; +import Utils from './Utils'; export default function ResponseRegionJsunit() { describe('appInfoTest', function () { @@ -26,7 +26,7 @@ export default function ResponseRegionJsunit() { beforeEach(async function (done) { console.info("ResponseRegion beforeEach start"); let options = { - uri: 'pages/general-properties/ResponseRegion', + uri: 'pages/ResponseRegion', } try { router.clear(); @@ -51,16 +51,6 @@ export default function ResponseRegionJsunit() { it('testResponseRegion01', 0, async function (done) { console.info('[testResponseRegion01] START'); - await Utils.sleep(1000); - let strJson = getInspectorByKey('region'); - let obj = JSON.parse(strJson); - console.info("[testResponseRegion01] obj is: " + JSON.stringify(obj)); - console.info('[testResponseRegion01] END'); - done(); - }); - - it('testResponseRegion02', 0, async function (done) { - console.info('[testResponseRegion02] START'); try { var eventData = { data: { @@ -68,25 +58,25 @@ export default function ResponseRegionJsunit() { } } var innerEvent = { - eventId: 120, + eventId: 30, priority: events_emitter.EventPriority.LOW } - console.info("[testResponseRegion02] start to publish emit:" + JSON.stringify(eventData.data)); + console.info("[testResponseRegion01] start to publish emit:" + JSON.stringify(eventData.data)); events_emitter.emit(innerEvent, eventData); } catch (err) { - console.log("[testResponseRegion02] change component data error: " + err.message); + console.log("[testResponseRegion01] change component data error: " + err.message); } await Utils.sleep(1000); - console.info('[testResponseRegion02] END'); + console.info('[testResponseRegion01] END'); done(); }); - it('testResponseRegion03', 0, async function (done) { + it('testResponseRegion02', 0, async function (done) { let rect = await Utils.getComponentRect('region') - console.info("[testResponseRegion03] rectInfo is " + JSON.stringify(rect)); + console.info("[testResponseRegion02] rectInfo is " + JSON.stringify(rect)); x_value = rect.left + (rect.right - rect.left) / 10 y_value = rect.top + (rect.bottom - rect.top) / 10 - console.info("[testResponseRegion03] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); + console.info("[testResponseRegion02] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); let point: TouchObject = { id: 1, x: x_value, @@ -94,24 +84,23 @@ export default function ResponseRegionJsunit() { type: TouchType.Down, } var callbackTwo = (eventData) => { - console.info("[testResponseRegion03] get event state result is: " + JSON.stringify(eventData)); + console.info("[testResponseRegion02] get event state result is: " + JSON.stringify(eventData)); expect(eventData.data.ACTION).assertEqual(true) expect(eventData.data.EVENT_TYPE).assertEqual('Down') } var innerEventTwo = { - eventId: 121, + eventId: 31, priority: events_emitter.EventPriority.LOW } try { events_emitter.on(innerEventTwo, callbackTwo) } catch (err) { - console.info("[testResponseRegion03] on events_emitter err : " + JSON.stringify(err)); + console.info("[testResponseRegion02] on events_emitter err : " + JSON.stringify(err)); } - console.info('[testResponseRegion03] testSendTouchEvent ' + sendTouchEvent(point)); + console.info('[testResponseRegion02] testSendTouchEvent ' + sendTouchEvent(point)); await Utils.sleep(1000) - console.info('[testResponseRegion03] END'); + console.info('[testResponseRegion02] END'); done(); }); - }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets index 6e42de95abf69852c816f36d9805cf395b210fb7..43b561dbf44628850eb423025446ac61b0ebc5c1 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets @@ -52,10 +52,10 @@ export default function scrollCodeJsunit() { let obj = JSON.parse(strJson); console.info("[test_scrollCode_001] component obj is: " + JSON.stringify(obj)); await Utils.sleep(1000); - expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.None'); + expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical'); expect(obj.$attrs.scrollBar).assertEqual('BarState.On'); expect(obj.$attrs.scrollBarColor).assertEqual('#FF0000FF'); - expect(obj.$attrs.scrollBarWidth).assertEqual('30.000000px'); + expect(obj.$attrs.scrollBarWidth).assertEqual('30.00px'); done(); }); @@ -69,7 +69,7 @@ export default function scrollCodeJsunit() { } } var innerEvent = { - eventId: 90, + eventId: 185, priority: events_emitter.EventPriority.LOW } console.info("[test_scrollCode_002] start to publish emit"); @@ -95,7 +95,7 @@ export default function scrollCodeJsunit() { } } var innerEvent = { - eventId: 80, + eventId: 186, priority: events_emitter.EventPriority.LOW } console.info("[test_scrollCode_003] start to publish emit"); @@ -121,7 +121,7 @@ export default function scrollCodeJsunit() { } } var innerEvent = { - eventId: 85, + eventId: 187, priority: events_emitter.EventPriority.LOW } console.info("[test_scrollCode_004] start to publish emit"); @@ -147,7 +147,7 @@ export default function scrollCodeJsunit() { } } var innerEvent = { - eventId: 95, + eventId: 188, priority: events_emitter.EventPriority.LOW } console.info("[test_scrollCode_005] start to publish emit"); @@ -159,7 +159,7 @@ export default function scrollCodeJsunit() { let strJson = getInspectorByKey('ScrollCode'); let obj = JSON.parse(strJson); console.info("[test_scrollCode_005] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.scrollBarWidth).assertEqual('40.000000px'); + expect(obj.$attrs.scrollBarWidth).assertEqual('40.00px'); done(); }); @@ -171,7 +171,7 @@ export default function scrollCodeJsunit() { expect(eventData.data.scrollToIndex).assertEqual(10) } var innerEvent = { - eventId: 30, + eventId: 189, priority: events_emitter.EventPriority.LOW } try { @@ -184,6 +184,5 @@ export default function scrollCodeJsunit() { console.info('[test_scrollCode_006] testSendTouchEvent END'); done(); }); - }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets similarity index 90% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets index 837f2d52086dcdc3a123ac1cb567807bfe1d2f73..46bcb79efee018fa7947426778a8ad73138a219e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; - import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; @@ -53,7 +51,7 @@ export default function shapeJsunit() { let strJson = getInspectorByKey('shape'); let obj = JSON.parse(strJson); console.info("shapeTest_0100 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.strokeDashOffset).assertEqual('0.000000px'); + expect(obj.$attrs.strokeDashOffset).assertEqual('0.00vp'); await Utils.sleep(1000); done(); }); @@ -130,7 +128,7 @@ export default function shapeJsunit() { let strJson = getInspectorByKey('shape'); let obj = JSON.parse(strJson); console.info("shapeTest_0800 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.strokeDashArray[0]).assertEqual('20.000000vp'); + expect(obj.$attrs.strokeDashArray[0]).assertEqual('20.00vp'); await Utils.sleep(1000); done(); }); @@ -141,7 +139,7 @@ export default function shapeJsunit() { let strJson = getInspectorByKey('shape'); let obj = JSON.parse(strJson); console.info("shapeTest_0900 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.strokeDashArray[1]).assertEqual('20.000000vp'); + expect(obj.$attrs.strokeDashArray[1]).assertEqual('20.00vp'); await Utils.sleep(1000); done(); }); @@ -156,7 +154,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1000 start to publish emit"); @@ -182,7 +180,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1100 start to publish emit"); @@ -208,7 +206,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1200 start to publish emit"); @@ -234,7 +232,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1300 start to publish emit"); @@ -260,7 +258,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1400 start to publish emit"); @@ -286,7 +284,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1500 start to publish emit"); @@ -312,7 +310,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1600 start to publish emit"); @@ -338,7 +336,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1700 start to publish emit"); @@ -364,7 +362,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1800 start to publish emit"); @@ -390,7 +388,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_1900 start to publish emit"); @@ -416,7 +414,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2000 start to publish emit"); @@ -442,7 +440,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2100 start to publish emit"); @@ -468,7 +466,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2200 start to publish emit"); @@ -494,7 +492,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2300 start to publish emit"); @@ -520,7 +518,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2400 start to publish emit"); @@ -546,7 +544,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2500 start to publish emit"); @@ -572,7 +570,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2600 start to publish emit"); @@ -598,7 +596,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2700 start to publish emit"); @@ -610,7 +608,7 @@ export default function shapeJsunit() { var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); console.info("shapeTest_2700 component obj is: " + JSON.stringify(obj.$attrs.strokeDashArray[0])); - expect(obj.$attrs.strokeDashArray[0]).assertEqual('4.000000vp'); + expect(obj.$attrs.strokeDashArray[0]).assertEqual('4.00vp'); done(); }); @@ -624,7 +622,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2800 start to publish emit"); @@ -636,7 +634,7 @@ export default function shapeJsunit() { var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); console.info("shapeTest_2800 component obj is: " + JSON.stringify(obj.$attrs.strokeDashArray[1])); - expect(obj.$attrs.strokeDashArray[1]).assertEqual('4.000000vp'); + expect(obj.$attrs.strokeDashArray[1]).assertEqual('4.00vp'); done(); }); @@ -650,7 +648,7 @@ export default function shapeJsunit() { } } var innerEvent = { - eventId: 901, + eventId: 192, priority: events_emitter.EventPriority.LOW } console.info("shapeTest_2900 start to publish emit"); @@ -662,7 +660,7 @@ export default function shapeJsunit() { var strJson = getInspectorByKey('shape'); var obj = JSON.parse(strJson); console.info("shapeTest_2900 component obj is: " + JSON.stringify(obj.$attrs.strokeDashArray[1])); - expect(obj.$attrs.strokeDashArray[2]).assertEqual('4.000000vp'); + expect(obj.$attrs.strokeDashArray[2]).assertEqual('4.00vp'); done(); }); @@ -676,6 +674,32 @@ export default function shapeJsunit() { await Utils.sleep(1000); done(); }); + + it('shapeTest_3100', 0, async function (done) { + console.info('shapeTest_3100 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineJoin": LineJoinStyle.Bevel, + } + } + var innerEvent = { + eventId: 192, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_3100 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_3100 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_3100 component obj is: " + JSON.stringify(obj.$attrs.strokeLineJoin)); + expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Bevel'); + done(); + }); }) } diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets old mode 100644 new mode 100755 similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets index 74f10806995706b5726908b5c4a492a69f3e0953..e3ef62cdf4deb1b27c80c64eaedf3c383bad17be --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets @@ -15,7 +15,7 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' import Utils from './Utils'; export default function sharedTransitionJsunit() { @@ -52,7 +52,6 @@ export default function sharedTransitionJsunit() { let obj = JSON.parse(strJson); console.info("sharedTransitionTest_0100 component obj is: " + JSON.stringify(obj)); expect(obj.$type).assertEqual('Navigator') - expect(obj.$ID).assertEqual(6) console.info('sharedTransitionTest_0100 END'); done(); }); @@ -90,7 +89,7 @@ export default function sharedTransitionJsunit() { } } let indexEvent = { - eventId: 555, + eventId: 194, priority: events_emitter.EventPriority.LOW } console.info("sharedTransitionTest_0400 start to publish emit"); @@ -105,7 +104,7 @@ export default function sharedTransitionJsunit() { expect(indexEventOne.data.type).assertEqual(SharedTransitionEffectType.Exchange); } let indexEventOne = { - eventId: 556, + eventId: 193, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets index c9a459bad0eab0db53012a758ee3cdad08d88157..84df05a37298c0fcb028c49c407c04cea8ef7557 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets @@ -47,7 +47,7 @@ export default function spanJsunit() { it('testSpan001', 0, async function (done) { console.info('[testSpan001] START'); - await Utils.sleep(2000); + await Utils.sleep(1000); let strJson = getInspectorByKey('decoration'); console.info("[testSpan001] component strJson:" + strJson); let obj = JSON.parse(strJson); @@ -77,7 +77,7 @@ export default function spanJsunit() { } } let indexEvent = { - eventId: 41, + eventId: 200, priority: events_emitter.EventPriority.LOW } console.info("[testSpan003] start to publish emit"); @@ -101,7 +101,7 @@ export default function spanJsunit() { console.info("[testSpan004] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[testSpan004] fontColor:" + obj.$attrs.fontColor); - expect(obj.$attrs.fontColor).assertEqual('#FF000000'); + expect(obj.$attrs.fontColor).assertEqual('#FFCCCCCC'); done(); }); @@ -114,7 +114,7 @@ export default function spanJsunit() { } } let indexEvent = { - eventId: 42, + eventId: 201, priority: events_emitter.EventPriority.LOW } console.info("[testSpan005] start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets index 64e3a8917ac2661dafa099bf228eb9c6895ecd67..5aaa4db47eec17de7d0ee232bcc016f44fa4c9f6 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets @@ -145,7 +145,7 @@ export default function tabsJsunit() { } } let indexEvent = { - eventId: 87, + eventId: 213, priority: events_emitter.EventPriority.LOW } console.info("testTabs_0900 start to publish emit"); @@ -171,7 +171,7 @@ export default function tabsJsunit() { } } let indexEvent = { - eventId: 87, + eventId: 213, priority: events_emitter.EventPriority.LOW } console.info("testTabs_1000 start to publish emit"); @@ -197,7 +197,7 @@ export default function tabsJsunit() { } } let indexEvent = { - eventId: 87, + eventId: 213, priority: events_emitter.EventPriority.LOW } console.info("testTabs_1100 start to publish emit"); @@ -223,7 +223,7 @@ export default function tabsJsunit() { } } let indexEvent = { - eventId: 87, + eventId: 213, priority: events_emitter.EventPriority.LOW } console.info("testTabs_1200 start to publish emit"); @@ -248,7 +248,7 @@ export default function tabsJsunit() { expect(indexEvent.data.ACTION).assertEqual(true); } let indexEvent = { - eventId: 88, + eventId: 212, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TapGesture.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TapGesture.test.ets index 4dbad3d6aa3c9047e3871e0e0371720204e8bfc2..f0fff984c581f90eeeed05367eb3d8f9e82485e7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TapGesture.test.ets @@ -62,7 +62,7 @@ export default function longPressGestureJsunit() { expect(eventData.data.ACTION).assertEqual(true) } var innerEvent = { - eventId: 82, + eventId: 214, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets index a683c7a05d920842176855c26aeae3d2e8a03ba6..dcb06dcb61813b31435830b7455ac28678845c40 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets @@ -83,7 +83,7 @@ export default function textJsunit() { } } let indexEvent = { - eventId: 60, + eventId: 226, priority: events_emitter.EventPriority.LOW } console.info("testText_0300 start to publish emit"); @@ -121,7 +121,7 @@ export default function textJsunit() { } } let indexEvent = { - eventId: 198, + eventId: 227, priority: events_emitter.EventPriority.LOW } console.info("testText_0500 start to publish emit"); @@ -158,7 +158,7 @@ export default function textJsunit() { } } let indexEvent = { - eventId: 127, + eventId: 228, priority: events_emitter.EventPriority.LOW } console.info("testText_0700 start to publish emit"); @@ -195,7 +195,7 @@ export default function textJsunit() { } } let indexEvent = { - eventId: 129, + eventId: 229, priority: events_emitter.EventPriority.LOW } console.info("testText_0900 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets index 4e127fdd3419fddef6ecd590e05a4074b0384c6e..83d6a9a13c5f5d78bb84f4f09fd0f01566f126ee 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets @@ -31,7 +31,7 @@ export default function timeStampJsunit(){ if (!("timeStamp" == pages.name)) { console.info("get timeStamp state success " + JSON.stringify(pages.name)); let result = await router.push(options); - await Utils.sleep(1000); + await Utils.sleep(2000); console.info("push timeStamp page success " + JSON.stringify(result)); } } catch (err) { @@ -41,7 +41,7 @@ export default function timeStampJsunit(){ }); afterEach(async function () { - await Utils.sleep(1000); + await Utils.sleep(2000); console.info("timeStamp after each called"); }); @@ -53,7 +53,7 @@ export default function timeStampJsunit(){ expect(indexEvent.data.Text).assertNotEqual(null); } let indexEvent = { - eventId: 235, + eventId: 230, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets index b00bdd94181a44003f850e88d94dbe34859898b8..514fa8a658ef0b53710cbf4193e278fb97059883 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets @@ -89,7 +89,7 @@ export default function ToggleJsunit() { } } let indexEvent = { - eventId: 1011, + eventId: 231, priority: events_emitter.EventPriority.LOW } console.info("testToggle04 start to publish emit"); @@ -115,7 +115,7 @@ export default function ToggleJsunit() { } } let indexEvent = { - eventId: 1012, + eventId: 232, priority: events_emitter.EventPriority.LOW } console.info("testToggle05 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets rename to ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets index 875c38a5bbb50c80ab9fde3388a718ffa8427ba2..dc9e0a78bd173ef5c0de4b8b363d2ea37c61be9c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets @@ -61,7 +61,7 @@ export default function transitionJsunit() { it('transitionTest_0200', 0, async function (done) { console.info('transitionTest_0200 START'); let indexEvent = { - eventId: 333, + eventId: 233, priority: events_emitter.EventPriority.LOW } await Utils.sleep(1000); @@ -89,7 +89,7 @@ export default function transitionJsunit() { } } let indexEvent = { - eventId: 112, + eventId: 234, priority: events_emitter.EventPriority.LOW } console.info("transitionTest_0300 start to publish emit"); @@ -115,7 +115,7 @@ export default function transitionJsunit() { } } let indexEvent = { - eventId: 112, + eventId: 234, priority: events_emitter.EventPriority.LOW } console.info("transitionTest_0400 start to publish emit"); diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/Utils.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/Utils.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f4b16d766f1feeb75edd8cc84cd1448d61e569a --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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. + */ + +export default class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Constants.ets b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Constants.ets new file mode 100755 index 0000000000000000000000000000000000000000..13a6c0d16e7277756efb5136ce8b02ac6b601d50 --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @ts-nocheck +/** + * 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/ace/ace_ets_component_three/entry/src/main/resources/base/element/color.json b/ace/ace_ets_component_three/entry/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_three/entry/src/main/resources/base/element/float.json b/ace/ace_ets_component_three/entry/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_three/entry/src/main/resources/base/element/string.json b/ace/ace_ets_component_three/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..ff4014526837abe1fd58255faac5456a6be449d0 --- /dev/null +++ b/ace/ace_ets_component_three/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_three/entry/src/main/resources/base/media/bg.jpg b/ace/ace_ets_component_three/entry/src/main/resources/base/media/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/resources/base/media/bg.jpg differ diff --git a/ace/ace_ets_component_three/entry/src/main/resources/base/media/icon.png b/ace/ace_ets_component_three/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/resources/base/media/icon.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/resources/rawfile/ic_health_heart.png b/ace/ace_ets_component_three/entry/src/main/resources/rawfile/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/resources/rawfile/ic_health_heart.png differ diff --git a/ace/ace_ets_component_three/entry/src/main/resources/rawfile/test.png b/ace/ace_ets_component_three/entry/src/main/resources/rawfile/test.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_three/entry/src/main/resources/rawfile/test.png differ diff --git a/ace/ace_ets_component_three/signature/openharmony_sx.p7b b/ace/ace_ets_component_three/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/ace/ace_ets_component_three/signature/openharmony_sx.p7b differ diff --git a/ace/ace_ets_component_two/BUILD.gn b/ace/ace_ets_component_two/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..29a3a020497e3e01d43f3217c4c7db2ab7163d8b --- /dev/null +++ b/ace/ace_ets_component_two/BUILD.gn @@ -0,0 +1,32 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("AceEtsComponentTwoTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_component_assets", + ":ace_ets_component_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AceEtsComponentTwoTest" +} +ohos_js_assets("ace_ets_component_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("ace_ets_component_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ace/ace_ets_component_two/Test.json b/ace/ace_ets_component_two/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..e792b3e20095775dcfec9c7fcc539fd34597744d --- /dev/null +++ b/ace/ace_ets_component_two/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.open.harmony.acetest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "AceEtsComponentTwoTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ace/ace_ets_component_two/entry/src/main/config.json b/ace/ace_ets_component_two/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..4c43ee3ab0109abb10a063ffa625d94b1ea0041a --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "app": { + "bundleName": "com.open.harmony.acetesttwo", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.acetesttwo", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.acetesttwo.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/animationStatus", + "pages/bindMenu", + "pages/bindPopup", + "pages/configuration", + "pages/curves", + "pages/direction", + "pages/divider", + "pages/datePicker", + "pages/direction2", + "pages/flexDirection", + "pages/flexWrap", + "pages/gradientDirection", + "pages/imageAnimator", + "pages/loadingProgress", + "pages/listItem", + "pages/NavigatorCode", + "pages/navigation", + "pages/pageTransition", + "pages/PieceCode", + "pages/placement", + "pages/radio", + "pages/row", + "pages/systemPrompt", + "pages/sourceType", + "pages/search", + "pages/scrollBar", + "pages/ohosRouterA", + "pages/ohosRouterB" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/app.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..52891e5511c95df08fd3e9965805e768c465e9ff --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,23 @@ +// @ts-nocheck +/** + * 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. + */ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/bg.jpg b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/bg.jpg differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/clip.png b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/clip.png new file mode 100755 index 0000000000000000000000000000000000000000..8bf4be4ee8ed5f13f3c3f8e4881a898199e4a57c Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/clip.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/dialog.png b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/dialog.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/dialog.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/download.png b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/download.png new file mode 100755 index 0000000000000000000000000000000000000000..3b1d0fd10bd28897bf3b1103e5bdba0fdb9d17f1 Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/download.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/ic_health_heart.png b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/ic_health_heart.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.jpeg b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.jpeg new file mode 100755 index 0000000000000000000000000000000000000000..30c4e9ecfe8396d327dfd5cf0528a43a4714db44 Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.jpeg differ diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.png b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.png new file mode 100755 index 0000000000000000000000000000000000000000..2a10f82cfa60d94e7a1ba9a613736739729c0cf6 Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/images/img.png differ diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets similarity index 91% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets index bd380f3151701729b0bebeb151ecab8a6bad276b..c5012865ccd84e0e4b363a127048659551af93cd 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -40,13 +40,13 @@ struct NavigatorCode { onPageShow() { console.info('navigatorCode page show called'); var stateChangeEvent = { - eventId: 90, + eventId: 137, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent = { - eventId: 101, + eventId: 138, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) @@ -60,7 +60,7 @@ struct NavigatorCode { Navigator() { Text('Back to previous page').width('100%').textAlign(TextAlign.Center) - }.active(this.active) + }.active(this.active).key('NavigatorType') .onClick(() => { this.active = true }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/PieceCode.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/PieceCode.ets index 270f8ad30d1aec85b5e4e596e6f85aa90ab14ad2..bba4e5c56c9255413be8960477ec335f8799c488 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/PieceCode.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -30,7 +30,7 @@ struct PieceCode { onPageShow() { console.info('piece page show called'); var stateChangeEvent = { - eventId: 82, + eventId: 154, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); @@ -75,7 +75,7 @@ struct PieceCode { } } var backEvent = { - eventId: 81, + eventId: 155, priority: events_emitter.EventPriority.LOW } console.info("piece onClose start to emit action state") @@ -97,7 +97,7 @@ struct PieceCode { } } var backEvent = { - eventId: 80, + eventId: 156, priority: events_emitter.EventPriority.LOW } console.info("close to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animationStatus.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/animationStatus.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animationStatus.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/animationStatus.ets index 619e85b5799441d9ecc2722d8c905bfb80140d26..a58982840d2df23c6809969ca60774300a4f3e33 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animationStatus.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/animationStatus.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -22,7 +22,6 @@ struct ImageAnimatorExample { @State reverse: boolean = false; @State iterations: number = 1; - build() { Column({ space:5 }) { ImageAnimator() @@ -94,7 +93,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 1119, + eventId: 56, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -113,7 +112,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 1120, + eventId: 57, priority: events_emitter.EventPriority.LOW } console.info("button3 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindMenu.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindMenu.ets index 55695c662fd246b83af2affddb9a54ebbee63f8c..af5db7b0f82b1e7ec9bb155a131f2b6a5a9b4a0d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindMenu.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -47,7 +47,7 @@ struct MenuExample { } } var backEvent = { - eventId: 123, + eventId: 64, priority: events_emitter.EventPriority.LOW } console.info("bindMenuTest_0100 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindPopup.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindPopup.ets index 72d274eea44ded48f9dcfca005cbe3238aeb9862..1f1932973b0ceace02a16b93d5a5033b2274f9e6 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/bindPopup.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -45,7 +45,7 @@ struct PopupExample { } } var backEvent = { - eventId: 238, + eventId: 65, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -77,7 +77,7 @@ struct PopupExample { } } var backEvent = { - eventId: 237, + eventId: 66, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") @@ -100,7 +100,7 @@ struct PopupExample { } } var backEvent = { - eventId: 236, + eventId: 67, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") @@ -128,7 +128,7 @@ struct PopupExample { onPageShow() { console.info('customPopupOption page show called'); var stateChangeEvent = { - eventId: 126, + eventId: 68, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/configuration.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/configuration.ets index f69ea4a04811020332c02fd5b0aa14bec69b1e10..14cfeeb6dd7ae422fbbd999179094c2fa278f3df 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/configuration.ets @@ -14,7 +14,8 @@ * limitations under the License. */ import Configuration from '@system.configuration'; -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct promptExample { @@ -38,7 +39,7 @@ struct promptExample { } console.log("backData is" + JSON.stringify(backData.data)); var backEvent = { - eventId: 36, + eventId: 78, priority: events_emitter.EventPriority.LOW } console.info("confituration start to emit action state"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/curves.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/curves.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/curves.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/curves.ets index 43911d0991d6ea52249b092b902920afee34db19..be4cab5c354d13acdb7e20547630dc76304de55f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/curves.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/curves.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; import Curves from '@ohos.curves' @Entry diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/datePicker.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/datePicker.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/datePicker.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/datePicker.ets index 54819de512b8a984cdd5df53f608081a4e857394..61944a6ef3be2aaad7fc38d032ac786209aeceef 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/datePicker.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/datePicker.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct DatePickerExample01 { @@ -39,7 +40,7 @@ struct DatePickerExample01 { } } var backEvent = { - eventId: 156, + eventId: 80, priority: events_emitter.EventPriority.LOW } console.info("DatePicker start to emit action state") @@ -54,7 +55,7 @@ struct DatePickerExample01 { onPageShow() { console.info('DatePicker page show called'); var stateChangeEvent = { - eventId: 155, + eventId: 81, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction.ets index 1ca26cf3f2d46ed907b77f08fb9c519b4b127c5d..d381e6d798a8e3e993bef18f126348a89181c393 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -38,7 +38,7 @@ struct Index { onPageShow() { console.info('direction page show called'); var stateChangeEvent = { - eventId: 985, + eventId: 84, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction2.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction2.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction2.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction2.ets index c4d0aad3c4386498f0afc4ba9fc3afa269dc0d1b..9a05b859a755c664162f651d05f73e45f690e875 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction2.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/direction2.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -47,13 +47,13 @@ struct PositionExample { onPageShow() { console.info('direction2 page show called'); var stateChangeEvent = { - eventId: 11123, + eventId: 82, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { - eventId: 11124, + eventId: 83, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/divider.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/divider.ets index 8dcc3ad0a36bdcb5f8b084e849f00b265906e7d6..7fa852f12c7cdf48ce6c1c914b4fbaf24431be84 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/divider.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct DividerExample { @@ -50,7 +51,7 @@ struct DividerExample { onPageShow() { console.info('divider page show called'); var stateChangeEvent = { - eventId: 917, + eventId: 85, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexDirection.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexDirection.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexDirection.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexDirection.ets index 062bd4aa204eeb3e02054e0461330c6930c84816..1a8df1b229fd3956ff1927e896f9c6252398433c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexDirection.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexDirection.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -21,7 +22,6 @@ struct flexDirectionExample { @State height: number = 40 @State backgroundColor: Color = 0xD2B48C - build() { Column() { Column({ space: 5 }) { @@ -65,17 +65,17 @@ struct flexDirectionExample { onPageShow() { console.info('flexDirection page show called'); var stateChangeEvent1 = { - eventId: 220, + eventId: 97, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent1, this.stateChangCallBack) var stateChangeEvent2 = { - eventId: 221, + eventId: 98, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent2, this.stateChangCallBack) var stateChangeEvent3 = { - eventId: 222, + eventId: 99, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent3, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexWrap.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexWrap.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexWrap.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexWrap.ets index 6ba3026fca4b651d035ecadfd7548e8acf0c81d5..06526afdf0ebb339fcce8d7872a2324f7c13c9b7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/flexWrap.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/flexWrap.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -41,7 +42,7 @@ struct FlexWrapExample { onPageShow() { console.info('flexDirection page show called'); var stateChangeEvent = { - eventId: 223, + eventId: 100, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gradientDirection.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/gradientDirection.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gradientDirection.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/gradientDirection.ets index ef7316fb149aee6caa718286ed63f8dd0a029358..f33d0d7734e135a0a7f75c87e6a0e6563527093c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gradientDirection.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/gradientDirection.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct linearGradientExample { @@ -38,19 +39,19 @@ struct linearGradientExample { onPageShow() { console.info('gradientDirection page show called'); var stateChangeEventOne = { - eventId: 117, + eventId: 106, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) console.info('gradientDirection page show called'); var stateChangeEventTwo = { - eventId: 116, + eventId: 107, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) console.info('gradientDirection page show called'); var stateChangeEventThree = { - eventId: 115, + eventId: 108, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventThree, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageAnimator.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageAnimator.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets index 98fb9ad91d2fd175e914b65955db39348ac6cde9..9dd6b5158baf1abb9a1f536262bbfaf8eded2ec5 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/imageAnimator.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/imageAnimator.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' + @Entry @Component struct ImageAnimatorExample { @@ -80,7 +81,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 561, + eventId: 114, priority: events_emitter.EventPriority.LOW } console.info("start to emit action state") @@ -105,7 +106,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 555, + eventId: 115, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") @@ -124,7 +125,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 556, + eventId: 116, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") @@ -143,7 +144,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 557, + eventId: 117, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -163,7 +164,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 558, + eventId: 118, priority: events_emitter.EventPriority.LOW } console.info("button3 start to emit action state") @@ -181,7 +182,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 559, + eventId: 119, priority: events_emitter.EventPriority.LOW } console.info("button4 start to emit action state") @@ -199,7 +200,7 @@ struct ImageAnimatorExample { } } var backEvent = { - eventId: 560, + eventId: 120, priority: events_emitter.EventPriority.LOW } console.info("button5 start to emit action state") @@ -214,7 +215,7 @@ struct ImageAnimatorExample { onPageShow() { console.info('imageAnimator page show called'); var stateChangeEvent = { - eventId: 562, + eventId: 121, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..a9c75c7154b8b5d6f5f76b1cf05cff275d4386f4 --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,64 @@ +// @ts-nocheck +/** + * 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 file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/listItem.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/listItem.ets index 554080a60a2011aa802f8ac6a9e34b0f3e32958c..bd2a774a7ae2a421c706e4b68dd2ba4a50c9c72e 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/listItem.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -26,13 +26,13 @@ struct ListItemExample { onPageShow() { console.info('[ListItem] page show called'); var stateChangeEvent = { - eventId: 1015, + eventId: 122, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEventOne = { - eventId: 1016, + eventId: 123, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/opacitySetting.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets similarity index 57% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/opacitySetting.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets index f5c34431e5f4d81b7166e1715e433c3d2b9d2a2f..f35d927d12d518c1b8b4676cc8830ce0fbaf3cd0 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/opacitySetting.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets @@ -13,36 +13,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component -struct OpacityExample { - @State opacityValue: string = 1; +struct LoadingProgressExample { + @State color: color = Color.Blue private stateChangCallBack = (eventData) => { + console.info("LoadingProgress page stateChangCallBack"); if (eventData != null) { - console.info("opacity page state change called:" + JSON.stringify(eventData)); - if(eventData.data.opacityValue != null) { - this.opacityValue = eventData.data.opacityValue; + console.info("LoadingProgress page state change called:" + JSON.stringify(eventData)); + if(eventData.data.color != null) { + this.color = eventData.data.color; + } } } - } onPageShow() { - console.info('opacity page show called'); + console.info('LoadingProgress page show called'); var stateChangeEvent = { - eventId: 100, + eventId: 124, priority: events_emitter.EventPriority.LOW } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); + events_emitter.on(stateChangeEvent, this.stateChangCallBack) } build() { Column({ space: 5 }) { - Text('opacity(1)').fontSize(9).width('90%').fontColor(0xCCCCCC) - Text().width('90%').height(50).opacity(`${this.opacityValue}`).backgroundColor(0xAFEEEE).key("opacity") - } - .width('100%') - .padding({ top: 5 }) + Text('Orbital LoadingProgress ') + .fontSize(19) + .fontColor(0xCCCCCC) + .width('90%') + .key('LP') + LoadingProgress() + .color(Color.Black) + }.width('100%').margin({ top: 6 }) } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/navigation.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/navigation.ets index de22da3e6cb9fc6a6e96010090998671574ca47b..d346aae3302118d15d57420efdcac279e7d840fe 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/navigation.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -48,7 +48,7 @@ struct NavigationExample { onPageShow() { console.info('progress page show called'); var stateChangeEvent = { - eventId: 555, + eventId: 135, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) @@ -115,7 +115,7 @@ struct NavigationExample { } } var backEvent = { - eventId: 44, + eventId: 1366, priority: events_emitter.EventPriority.LOW } console.info("navigationContent1 start to emit action state") @@ -132,7 +132,7 @@ struct NavigationExample { .titleMode(NavigationTitleMode.Free) .hideTitleBar(false) .hideBackButton(false) - .onTitleModeChange((titleModel: NavigationTitleMode) => { + .onTitleModeChanged((titleModel: NavigationTitleMode) => { console.log('titleMode') }) .toolBar({ items: [ @@ -148,4 +148,4 @@ struct NavigationExample { .hideToolBar(this.hideBar) } } -} +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets index 08de713d902f04cdb33f1b36a5b85e1ef5b726e9..d0ad16331461c0dc66f17903ef3b88b43de2852a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterA.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets similarity index 92% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets index 8cca7ea66475e0245a45a3c747333affb2bf3e24..c1817d497c548563057f28a53cd8ca1ad7073336 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/ohosRouterB.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +14,8 @@ * limitations under the License. */ import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; + @Entry @Component struct OhosRouterB { @@ -39,7 +41,7 @@ struct OhosRouterB { } } let paramsEvent = { - eventId: 3, + eventId: 142, priority: events_emitter.EventPriority.LOW } console.info("[OhosRouterB] start to emit params"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets index d9693f2ba2d33a1413f1baaba4dc75632e4f436c..4a5e619c121e76034190b10079448640be0dbc1c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' + @Entry @Component struct PageTransitionExample1 { @@ -42,7 +43,7 @@ struct PageTransitionExample1 { } } var backEvent = { - eventId: 96, + eventId: 144, priority: events_emitter.EventPriority.LOW } console.info("pageTransition start to emit action state") @@ -72,7 +73,7 @@ struct PageTransitionExample1 { events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { - eventId: 95, + eventId: 145, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEventOne, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition2.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition2.ets index a16c291aed45f29ff4cadc9de0993239b5ece134..fab041ca7466ef3b6c635e551a555202475baffe 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition2.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' + @Entry @Component struct AExample { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/placement.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/placement.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/placement.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/placement.ets index a9b2b9572806a4b2de9dcbdc15db80c59776259c..de93544c2e9b7631fb41533db0846031facef4c5 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/placement.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/placement.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -61,7 +61,7 @@ struct PlacementExample { } } var backEvent = { - eventId: 240, + eventId: 157, priority: events_emitter.EventPriority.LOW } console.info("button start to emit action state") @@ -95,7 +95,7 @@ struct PlacementExample { } } var backEventOne = { - eventId: 241, + eventId: 158, priority: events_emitter.EventPriority.LOW } console.info("button1 start to emit action state") @@ -129,7 +129,7 @@ struct PlacementExample { } } var backEventTwo = { - eventId: 242, + eventId: 159, priority: events_emitter.EventPriority.LOW } console.info("button2 start to emit action state") @@ -163,7 +163,7 @@ struct PlacementExample { } } var backEventThree = { - eventId: 243, + eventId: 160, priority: events_emitter.EventPriority.LOW } console.info("button3 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/radio.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/radio.ets index 6a2b1bf132b31a47fa0c368daf801abb97206f25..56a8b29318e6a783d17707e1d499fbe2b90da314 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/radio.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/row.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/row.ets index a9717066846224312c2c21cf705513cc79defa67..762810d81be8585b15e979bfcdcbb6f16836b0c3 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/row.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -36,7 +37,7 @@ struct RowTest { onPageShow() { console.info('row page show called'); var stateChangeEvent = { - eventId: 55, + eventId: 182, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/scrollBar.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/scrollBar.ets index b9e418387b71dc255bd13a870e78b28cb6b88895..c2d57b9091b08e395583e698265d6c551ca17fb7 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/scrollBar.ets @@ -14,7 +14,7 @@ * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -41,13 +41,13 @@ struct ScrollBarExample { onPageShow() { console.info('scrollBar page show called'); var stateChangeEvent = { - eventId: 80, + eventId: 183, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); var stateChangeEvent2 = { - eventId: 41, + eventId: 184, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent2, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets index 7fcfe767a9345d1c40da7b2865c7a4d5c2e4abea..8a3416b8d84e447c91edc77d64ff3764fc1d80c4 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter' +import events_emitter from '@ohos.emitter' @Entry @Component @@ -39,7 +39,7 @@ struct SearchExample { onPageShow() { console.info('search page show called'); var stateChangeEvent = { - eventId: 40, + eventId: 190, priority: events_emitter.EventPriority.LOW } events_emitter.on(stateChangeEvent, this.stateChangCallBack); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets index 29636c5c27b4de9fa4ecd1411b528e331e7159ee..2ecc83f9745cd1b833ab0f76b91166aa50c93b30 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; +import events_emitter from '@ohos.emitter'; @Entry @Component @@ -50,7 +50,7 @@ struct ClickExample { } } var backEvent = { - eventId: 155, + eventId: 198, priority: events_emitter.EventPriority.LOW } console.info("sourceTypeTest_0100 start to emit action state") diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/systemPrompt.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/systemPrompt.ets index 7d0e30787a652b6e81c823183e86085187de1de4..c59ce91220a65bd9c473e7244dd58ee2661b585f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/systemPrompt.ets @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import events_emitter from '@ohos.events.emitter'; import prompt from '@system.prompt'; @Entry diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets index dc8740a57e904934c68a43722dcfb1b184d1eabb..d2c24a0026236d4878edb2308822be0783539ece 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/AnimationStatusJsunit.test.ets @@ -76,7 +76,7 @@ export default function animationStatusJsunit() { expect(indexEvent.data.animationStatus).assertEqual(AnimationStatus.Paused); } let indexEvent = { - eventId: 1119, + eventId: 56, priority: events_emitter.EventPriority.LOW } try { @@ -98,7 +98,7 @@ export default function animationStatusJsunit() { expect(indexEvent.data.animationStatus).assertEqual(AnimationStatus.Stopped); } let indexEvent = { - eventId: 1120, + eventId: 57, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets index e851d768bfc052223bdcba5a890772d840e40cf4..92b64e4d14815efcf417e1b9b14a5c0f1ba68365 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets @@ -55,7 +55,7 @@ export default function aboutToDisappearJsunit() { expect(indexEvent.data.ACTION).assertEqual(true); } let indexEvent = { - eventId: 123, + eventId: 64, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets index 6ff43845e1c67dfe45354612668d340899e60093..f777eb73866c9c668f88e86e39f968dd5cee82a5 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets @@ -54,7 +54,7 @@ export default function customPopupOptionJsunit(){ expect(indexEvent.data.maskColor).assertEqual(0x33000000); } let indexEvent = { - eventId: 236, + eventId: 67, priority: events_emitter.EventPriority.LOW } try { @@ -80,7 +80,7 @@ export default function customPopupOptionJsunit(){ } } let indexEvent = { - eventId: 126, + eventId: 68, priority: events_emitter.EventPriority.LOW } console.info("bindPopupTest_0200 start to publish emit"); @@ -95,7 +95,7 @@ export default function customPopupOptionJsunit(){ expect(indexEventOne.data.maskColor).assertEqual(0x33000009); } let indexEventOne = { - eventId: 237, + eventId: 66, priority: events_emitter.EventPriority.LOW } try { @@ -117,7 +117,7 @@ export default function customPopupOptionJsunit(){ expect(indexEvent.data.placementOnTop).assertEqual(false); } let indexEvent = { - eventId: 238, + eventId: 65, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets index 91157ca6438406fc574bed54f38dc4346aaca1dc..e4c0aa684566704686030b4ead0637548438439a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets @@ -54,7 +54,7 @@ export default function transFormJsunit() { expect(backData.data.DIR).assertEqual('ltr'); } var configurationEvent = { - eventId: 36, + eventId: 78, priority: events_emitter.EventPriority.LOW } events_emitter.on(configurationEvent, callBackConfiguration); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets similarity index 94% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets index c20f5280f5dbc320e436e1339a3215574d78f8b4..36d6dc95500d46f1f3e24801471344a44d946663 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/CurvesJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function curvesJsunit() { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets index 70e0608c243008528b85664fc0ffd06b1fa7fc2b..70958e7d0d983affbd02e33742b36ca719083cec 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DatePickerJsunit.test.ets @@ -52,6 +52,7 @@ export default function datePickerJsunit() { let obj = JSON.parse(strJson); console.info("datePickerText_0100 component obj is: " + JSON.stringify(obj)); expect(obj.$type).assertEqual('DatePicker'); + console.info('datePickerTest_0200 END'); done(); }); @@ -75,7 +76,7 @@ export default function datePickerJsunit() { } } let indexEvent = { - eventId: 155, + eventId: 81, priority: events_emitter.EventPriority.LOW } console.info("datePickerTest_0300 start to publish emit"); @@ -88,7 +89,7 @@ export default function datePickerJsunit() { expect(obj.$attrs.useMilitaryTime).assertEqual('false'); } let indexEventOne = { - eventId: 156, + eventId: 80, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets index 1a83cd9c4ae6fab917d6567a0098842e23f45222..115268a6420c490d7754cd619f72fc1dfb138838 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Direction2Jsunit.test.ets @@ -64,7 +64,7 @@ export default function direction2Jsunit(){ } } let indexEvent = { - eventId: 11123, + eventId: 82, priority: events_emitter.EventPriority.LOW } console.info("direction2Test_0200 start to publish emit"); @@ -90,7 +90,7 @@ export default function direction2Jsunit(){ } } let indexEvent = { - eventId: 11124, + eventId: 83, priority: events_emitter.EventPriority.LOW } console.info("direction2Test_0300 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets index 33eee8d3fe5d05072fea077a1b44c157b98f5e30..0dcaf9583219df2ee6dc97a5da78bc31f8291db1 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets @@ -64,7 +64,7 @@ export default function directionJsunit(){ } } let indexEvent = { - eventId: 985, + eventId: 84, priority: events_emitter.EventPriority.LOW } console.info("directionTest_0200 start to publish emit"); @@ -90,7 +90,7 @@ export default function directionJsunit(){ } } let indexEvent = { - eventId: 985, + eventId: 84, priority: events_emitter.EventPriority.LOW } console.info("directionTest_0300 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets index 0e981d1ebd7fd6794c3a5937aee087afd0e01388..7a3ad0031e3c6e7521838ec544d47ba9911a8425 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets @@ -52,6 +52,7 @@ export default function dividerJsunit() { let obj = JSON.parse(strJson); console.info("dividerTest_0100 component obj is: " + JSON.stringify(obj)); expect(obj.$type).assertEqual('Divider'); + console.info('dividerTest_0200 END'); done(); }); @@ -75,7 +76,7 @@ export default function dividerJsunit() { } } let indexEvent = { - eventId: 917, + eventId: 85, priority: events_emitter.EventPriority.LOW } console.info("dividerTest_0300 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets index 5b0d380749a740d2271dd388896aa5da04191bae..4f7d9b0dda112efccf3c62f4a7e9757ff7365064 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexDirectionJsunit.test.ets @@ -129,7 +129,7 @@ export default function flexDirectionJsunit(){ } } let indexEvent = { - eventId: 220, + eventId: 97, priority: events_emitter.EventPriority.LOW } console.info("flexDirection_0700 start to publish emit"); @@ -159,7 +159,7 @@ export default function flexDirectionJsunit(){ } } let indexEvent = { - eventId: 221, + eventId: 98, priority: events_emitter.EventPriority.LOW } console.info("flexDirection_0800 start to publish emit"); @@ -189,7 +189,7 @@ export default function flexDirectionJsunit(){ } } let indexEvent = { - eventId: 222, + eventId: 99, priority: events_emitter.EventPriority.LOW } console.info("flexDirection_0900 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets index dfb98b8f0366d2d3fa705b05978eb22805190d01..03764c63f1a9b05e3af23adb6da8881131974d07 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/FlexWrapJsunit.test.ets @@ -80,7 +80,7 @@ export default function flexWrapJsunit() { } } let indexEvent = { - eventId: 223, + eventId: 100, priority: events_emitter.EventPriority.LOW } console.info("flexWrap_0300 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets index a72ef7a4cd0f81f0e113c5b41740f37ca9052f62..28c6b82c1d936a3970e5bda5a2d244f256080df4 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/GradientDirectionJsunit.test.ets @@ -66,7 +66,7 @@ export default function gridJsunit() { } } let indexEvent = { - eventId: 117, + eventId: 106, priority: events_emitter.EventPriority.LOW } console.info("GradientDirectionTest_0200 start to publish emit"); @@ -93,7 +93,7 @@ export default function gridJsunit() { } } let indexEvent = { - eventId: 116, + eventId: 107, priority: events_emitter.EventPriority.LOW } console.info("GradientDirectionTest_0300 start to publish emit"); @@ -120,7 +120,7 @@ export default function gridJsunit() { } } let indexEvent = { - eventId: 115, + eventId: 108, priority: events_emitter.EventPriority.LOW } console.info("GradientDirectionTest_0400 start to publish emit"); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets index 13d148959144d020b399ee7fbc424e775c8beefa..d9f27c8d044f906195e3b4dd3d9d8e880782102a 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ImageAnimatorJsunit.test.ets @@ -55,7 +55,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.state).assertEqual(AnimationStatus.Running); } let indexEvent = { - eventId: 555, + eventId: 115, priority: events_emitter.EventPriority.LOW } try { @@ -78,7 +78,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.fixedSize).assertEqual(false); } let indexEvent = { - eventId: 556, + eventId: 116, priority: events_emitter.EventPriority.LOW } try { @@ -101,7 +101,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.preDecode).assertEqual(0); } let indexEvent = { - eventId: 557, + eventId: 117, priority: events_emitter.EventPriority.LOW } try { @@ -123,7 +123,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.fillMode).assertEqual(Forwards); } let indexEvent = { - eventId: 558, + eventId: 118, priority: events_emitter.EventPriority.LOW } try { @@ -145,7 +145,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.iterations).assertEqual(1); } let indexEvent = { - eventId: 559, + eventId: 119, priority: events_emitter.EventPriority.LOW } try { @@ -167,7 +167,7 @@ export default function imageAnimatorJsunit(){ expect(indexEvent.data.string).assertEqual('repeat'); } let indexEvent = { - eventId: 561, + eventId: 114, priority: events_emitter.EventPriority.LOW } try { @@ -190,7 +190,7 @@ export default function imageAnimatorJsunit(){ } } let indexEvent = { - eventId: 562, + eventId: 121, priority: events_emitter.EventPriority.LOW } console.info("imageAnimatorTest_0700 start to publish emit"); @@ -204,7 +204,7 @@ export default function imageAnimatorJsunit(){ expect(indexEventOne.data.preDecode).assertEqual(2); } let indexEventOne = { - eventId: 560, + eventId: 120, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fa73d85c091286ab15f9aace67fd06f48334e677 --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/List.test.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. + */ +import bindMenuJsunit from './BindMenuJsunit.test.ets'; +import bindPopupJsunit from './BindPopupJsunit.test.ets'; +import directionJsunit from './DirectionJsunit.test.ets'; +import listItemJsunit from './ListItemJsunit.test.ets'; +import navigatorCodeJsunit from './NavigatorCodeJsunit.test.ets'; +import pieceJsunit from './PieceJsunit.test.ets'; +import dividerJsunit from './DividerJsunit.test.ets'; +import systempromptJsunit from './SystempromptJsunit.test.ets'; +import configurationJsunit from './ConfigurationJsunit.test.ets'; +import sourceTypeJsunit from './SourceTypeJsunit.test.ets'; +import pageTransitionJsunit from './PageTransitionJsunit.test.ets'; +import navigationJsunit from './NavigationJsunit.test.ets'; +import loadingProgressJsunit from './LoadingProgressJsunit.test.ets'; +import radioJsunit from './RadioJsunit.test.ets'; +import rowJsunit from './RowJsunit.test.ets'; +import scrollBarJsunit from './ScrollBarJsunit.test.ets'; +import searchJsunit from './SearchJsunit.test.ets'; +import placementJsunit from './PlacementJsunit.test.ets'; +import imageAnimatorJsunit from './ImageAnimatorJsunit.test.ets' +import animationStatusJsunit from './AnimationStatusJsunit.test.ets'; +import curvesJsunit from './CurvesJsunit.test.ets'; +import gradientDirectionJsunit from './GradientDirectionJsunit.test.ets'; +import ohosRouterJsunit from './OhosRouterJsnuit.test.ets'; +import flexDirectionJsunit from './FlexDirectionJsunit.test.ets'; +import flexWrapJsunit from './FlexWrapJsunit.test.ets'; +import datePickerJsunit from './DatePickerJsunit.test.ets'; +import direction2Jsunit from './Direction2Jsunit.test.ets'; + +export default function testsuite() { + navigationJsunit(); + ohosRouterJsunit(); + pageTransitionJsunit(); + datePickerJsunit(); + flexWrapJsunit(); + flexDirectionJsunit(); + gradientDirectionJsunit(); + dividerJsunit(); + directionJsunit(); + direction2Jsunit(); + animationStatusJsunit(); + searchJsunit(); + scrollBarJsunit(); + bindMenuJsunit(); + bindPopupJsunit(); + configurationJsunit(); + curvesJsunit(); + imageAnimatorJsunit(); + loadingProgressJsunit(); + listItemJsunit(); + navigatorCodeJsunit(); + pieceJsunit(); + placementJsunit(); + radioJsunit(); + rowJsunit(); + systempromptJsunit(); + sourceTypeJsunit(); +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets index 5e8c689f73deb4d3adcfd01f156f80388012a983..dd833ee0016d631eff4ec2f3d8e18b9b8d860661 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets @@ -66,7 +66,7 @@ export default function listItemJsunit() { } } var innerEvent = { - eventId: 1015, + eventId: 122, priority: events_emitter.EventPriority.LOW } console.info("[testListItem02] start to publish emit"); @@ -103,7 +103,7 @@ export default function listItemJsunit() { } } var innerEvent = { - eventId: 1016, + eventId: 123, priority: events_emitter.EventPriority.LOW } console.info("[testListItem04] start to publish emit"); 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 new file mode 100755 index 0000000000000000000000000000000000000000..5cc1bab04a481b23234e1b9c0f4c9395c1c9755d --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets @@ -0,0 +1,113 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import Utils from './Utils'; + +export default function loadingProgressJsunit() { + describe('loadingProgressTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/loadingProgress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get loadingProgress state success " + JSON.stringify(pages)); + if (!("loadingProgress" == pages.name)) { + console.info("get loadingProgress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(4000); + console.info("push loadingProgress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push loadingProgress page error " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("loadingProgress after each called"); + }); + + it('testLoadingProgress_100', 0, async function (done) { + console.info('[testLoadingProgress_100] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_100 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.borderColor).assertEqual("#FF000000"); + console.info('testLoadingProgress_100 END'); + done(); + }); + + it('testLoadingProgress_200', 0, async function (done) { + console.info('[testLoadingProgress_200] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.borderRadius).assertEqual("0.0vp"); + console.info('testLoadingProgress_200 END'); + done(); + }); + + it('testLoadingProgress_300', 0, async function (done) { + console.info('[testLoadingProgress_300] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.height).assertEqual("22.000000"); + console.info('testLoadingProgress_300 END'); + done(); + }); + + it('testLoadingProgress_400', 0, async function (done) { + console.info('[testLoadingProgress_400] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_400 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.borderWidth).assertEqual("0.00px"); + console.info('testLoadingProgress_400 END'); + done(); + }); + + it('testLoadingProgress_500', 0, async function (done) { + console.info('[testLoadingProgress_500] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_500 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Solid"); + console.info('testLoadingProgress_500 END'); + done(); + }); + + it('testLoadingProgress_600', 0, async function (done) { + console.info('[testLoadingProgress_600] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LP'); + let obj = JSON.parse(strJson); + console.info("testLoadingProgress_600 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.backgroundColor).assertEqual("#00000000"); + console.info('testLoadingProgress_600 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets similarity index 74% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets index e85f4a61d45f8524a7d1af9d27f044555457a081..4a1505ecc504c3e8818a2ec443a6e7ba865c936f 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,7 +52,7 @@ export default function navigationJsunit() { let strJson = getInspectorByKey('Navigation'); let obj = JSON.parse(strJson); console.info("[testNavigation_100] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.width).assertEqual("100.000000%"); + expect(obj.$attrs.width).assertEqual("100.00%"); console.info('[testNavigation_100] END'); done(); }); @@ -64,7 +65,7 @@ export default function navigationJsunit() { expect(indexEvent.data.ACTION).assertEqual(false); } let indexEvent = { - eventId: 44, + eventId: 136, priority: events_emitter.EventPriority.LOW } try { @@ -84,41 +85,19 @@ export default function navigationJsunit() { let strJson = getInspectorByKey('Navigation'); let obj = JSON.parse(strJson); console.info("[testNavigation_300] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.height).assertEqual("300.000000vp"); + expect(obj.$attrs.height).assertEqual("300.00vp"); console.info('[testNavigation_300] END'); done(); }); it('testNavigation_400', 0, async function (done) { - console.info('testNavigation_400 START'); - await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("testNavigation_400 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.ACTION).assertEqual(true); - } - let indexEvent = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - try { - events_emitter.on(indexEvent, callback); - } catch (err) { - console.info("testNavigation_400 on events_emitter err : " + JSON.stringify(err)); - } - console.info("testNavigation_400 click result is: " + JSON.stringify(sendEventByKey('NavigationContent1',10,""))); - await Utils.sleep(2000); - console.info('testNavigation_400 END'); - done(); - }); - - it('testNavigation_500', 0, async function (done) { - console.info('[testNavigation_500] START'); + console.info('[testNavigation_400] START'); await Utils.sleep(1000); let strJson = getInspectorByKey('Navigation'); let obj = JSON.parse(strJson); - console.info("[testNavigation_500] obj is: " + JSON.stringify(obj)); + console.info("[testNavigation_400] obj is: " + JSON.stringify(obj)); expect(obj.$attrs.align).assertEqual("Alignment.Center"); - console.info('[testNavigation_500] END'); + console.info('[testNavigation_400] END'); done(); }); }) diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..29c8d998e8c59d657eea07a67c0f20d1c56a8319 --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets @@ -0,0 +1,108 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function navigatorCodeJsunit() { + describe('NavigatorClickTest', function () { + beforeEach(async function (done) { + console.info("NavigatorClick beforeEach start"); + let options = { + uri: 'pages/NavigatorCode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get NavigatorClick state pages:" + JSON.stringify(pages)); + if (!("NavigatorClick" == pages.name)) { + console.info("get NavigatorClick state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push NavigatorClick page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push NavigatorClick page error:" + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("NavigatorClick after each called"); + }); + + it('test_NavigatorClick_001', 0, async function (done) { + console.info('[test_NavigatorClick_001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('NavigatorType'); + let obj = JSON.parse(strJson); + console.info("[test_NavigatorClick_001] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.active).assertEqual('false'); + console.info('[test_NavigatorClick_001] END'); + done(); + }); + + it('test_NavigatorClick_002', 0, async function (done) { + console.info('[test_NavigatorClick_002] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "typeValue": "NavigationType.Back" + } + } + var innerEvent = { + eventId: 138, + priority: events_emitter.EventPriority.LOW + } + console.info("[test_NavigatorClick_002] start to publish emit" + JSON.stringify(eventData)); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[test_NavigatorClick_002] change component error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('NavigatorType'); + var obj = JSON.parse(strJson); + console.info("[test_NavigatorClick_002] component obj is: " + JSON.stringify(obj.$attrs.type)); + expect(obj.$attrs.type).assertEqual('NavigationType.Back'); + done(); + }); + + it('test_NavigatorClick_003', 0, async function (done) { + await Utils.sleep(1000) + var callback = (eventData) => { + console.info("[test_NavigatorClick_003] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(10) + } + var innerEvent = { + eventId: 139, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[test_NavigatorClick_003] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[test_NavigatorClick_003] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, ""))); + await Utils.sleep(1000) + console.info('[test_NavigatorClick_003] testSendTouchEvent END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets index e5c023f69450883a1f3d5901c4e64d2501673660..06163dd7a740e0f9d7dca00a85b4cbb179e20235 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/OhosRouterJsnuit.test.ets @@ -13,18 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; import events_emitter from '@ohos.events.emitter'; - export default function OhosRouterJsunit() { describe('ohosRouterTest', function () { beforeEach(async function (done) { let options = { - uri: 'pages/ohosRouter', + uri: 'pages/ohosRouterA', } try { router.clear(); @@ -57,7 +55,7 @@ export default function OhosRouterJsunit() { await Utils.sleep(1000); console.info("[ohosRouterTest001] push page success " + JSON.stringify(result)); let pages = router.getState(); - expect(pages.index).assertEqual(2); + expect(pages.index).assertEqual(3); expect(pages.name).assertEqual('ohosRouterA'); expect(pages.path).assertEqual('pages/'); } catch (err) { @@ -84,7 +82,7 @@ export default function OhosRouterJsunit() { expect(paramsEvent.data.params).assertEqual('B Page'); } let paramsEvent = { - eventId: 3, + eventId: 142, priority: events_emitter.EventPriority.LOW } try { @@ -161,7 +159,7 @@ export default function OhosRouterJsunit() { expect(paramsEvent.data.params).assertEqual('B Page'); } let paramsEvent = { - eventId: 3, + eventId: 142, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets index 7b6f5fed78321e04dba228d243d69919134ebb18..63f3388c843cef6a4405f47a3777fce54f212896 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets @@ -89,7 +89,7 @@ export default function pageTransitionJsunit() { } } let indexEvent = { - eventId: 95, + eventId: 145, priority: events_emitter.EventPriority.LOW } console.info("pageTransitionTest_0400 start to publish emit"); @@ -104,7 +104,7 @@ export default function pageTransitionJsunit() { expect(indexEventOne.data.type).assertEqual(RouteType.Pop); } let indexEventOne = { - eventId: 96, + eventId: 144, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f4e7c823505b6e238216b30cbf6a6622d87d310c --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets @@ -0,0 +1,83 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils'; + +export default function pieceJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/PieceCode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get PieceCode state success " + JSON.stringify(pages)); + if (!("PieceCode" == pages.name)) { + console.info("get PieceCode pages success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push PieceCode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push PieceCode page error " + JSON.stringify(err)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("PieceCode after each called"); + }); + + it('test_pieceCode_01', 0, async function (done) { + console.info('test_pieceCode_01 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("test_pieceCode_01 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.showDelete).assertEqual(true); + } + let indexEvent = { + eventId: 156, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("test_pieceCode_01 on events_emitter err : " + JSON.stringify(err)); + } + console.info("test_pieceCode_01 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); + await Utils.sleep(1000); + var callback1 = (eventData) => { + console.info("test_pieceCode_01 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true); + } + var innerEventOne = { + eventId: 155, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("test_pieceCode_01 on events_emitter err : " + JSON.stringify(err)); + } + console.info('test_pieceCode_01 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets index 1ec8c1d1b8be38f3722b42e68cf5aeb48f6ca4ad..487bf332cbb09d650727dd27a59bdf18353b50fa 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/PlacementJsunit.test.ets @@ -20,7 +20,6 @@ import events_emitter from '@ohos.events.emitter'; export default function placementJsunit(){ describe('placementTest', function (){ - beforeEach(async function (done) { let options = { uri: 'pages/placement', @@ -54,7 +53,7 @@ export default function placementJsunit(){ expect(indexEvent.data.placement).assertEqual(Placement.TopLeft); } let indexEvent = { - eventId: 240, + eventId: 157, priority: events_emitter.EventPriority.LOW } try { @@ -77,7 +76,7 @@ export default function placementJsunit(){ expect(indexEventOne.data.placement).assertEqual(Placement.TopRight); } let indexEventOne = { - eventId: 241, + eventId: 158, priority: events_emitter.EventPriority.LOW } try { @@ -100,7 +99,7 @@ export default function placementJsunit(){ expect(indexEventTwo.data.placement).assertEqual(Placement.BottomLeft); } let indexEventTwo = { - eventId: 242, + eventId: 159, priority: events_emitter.EventPriority.LOW } try { @@ -123,7 +122,7 @@ export default function placementJsunit(){ expect(indexEventThree.data.placement).assertEqual(Placement.BottomRight); } let indexEventThree = { - eventId: 243, + eventId: 160, priority: events_emitter.EventPriority.LOW } try { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets similarity index 93% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets index 3a937c240e91c028d4200355453542429bc6a90b..9773c4c6871eba3c5d193df66eb23f4c57bb2807 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,7 +31,7 @@ export default function radioJsunit() { if (!("radio" == pages.name)) { console.info("get radio state success " + JSON.stringify(pages.name)); let result = await router.push(options); - await Utils.sleep(4000); + await Utils.sleep(3000); console.info("push radio page success " + JSON.stringify(result)); } } catch (err) { @@ -50,6 +51,7 @@ export default function radioJsunit() { let strJson = getInspectorByKey('radio1'); let obj = JSON.parse(strJson); console.info("testRadio_100_component obj is: " + JSON.stringify(obj)); + console.info("testRadio_100_obj.$attrs.value: " + obj.$attrs.value); expect(obj.$type).assertEqual('Radio'); expect(obj.$attrs.checked).assertEqual('true'); console.info('testRadio_100 END'); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets similarity index 96% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets index fae9a3ce8371e12c0f3f154fb2f4bfeae4241b22..c1b47e77ac9307eeefdb73ac2bb69995315ee917 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets @@ -1,3 +1,4 @@ +// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +17,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; -import events_emitter from '@ohos.events.emitter'; export default function rowJsunit() { describe('rowTest', function () { diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets similarity index 80% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets index 621c05f410cfd7de724b3a9ba25dbc3c993c60b9..bad3bca8a75db07f6d6f76377824855fee9e89ff 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets @@ -68,7 +68,7 @@ export default function scrollBarJsunit() { } } var innerEvent = { - eventId: 80, + eventId: 183, priority: events_emitter.EventPriority.LOW } console.info("[testScrollBar002] start to publish emit:" + JSON.stringify(eventData.data)); @@ -105,7 +105,7 @@ export default function scrollBarJsunit() { } } let indexEvent = { - eventId: 41, + eventId: 184, priority: events_emitter.EventPriority.LOW } console.info("[testScrollBar004] start to publish emit"); @@ -121,5 +121,31 @@ export default function scrollBarJsunit() { expect(obj.$attrs.state).assertEqual('BarState.Off'); done(); }); + + it('testScrollBar005', 0, async function (done) { + console.info('[testScrollBar005] START'); + try { + let eventData = { + data: { + "stateValue": BarState.Auto + } + } + let indexEvent = { + eventId: 184, + priority: events_emitter.EventPriority.LOW + } + console.info("[testScrollBar005] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testScrollBar005] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('scroll'); + console.info("[testScrollBar005] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testScrollBar005] state:" + obj.$attrs.state); + expect(obj.$attrs.state).assertEqual('BarState.Off'); + done(); + }); }) } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets similarity index 68% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets index 8b452f30e9422260167286163ad71b71037b2b0c..04134b3173f09d45967e3bf757190433b8aa177d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets @@ -51,7 +51,7 @@ export default function searchJsunit() { let strJson = getInspectorByKey('search'); console.info("[testSearch001] component strJson:" + strJson); let obj = JSON.parse(strJson); - expect(obj.$attrs.textFont).assertEqual(10); + expect(obj.$attrs.searchButton).assertEqual('10'); done(); }); @@ -61,11 +61,11 @@ export default function searchJsunit() { try { var eventData = { data: { - "textFont": "5" + "searchButton": "5" } } var innerEvent = { - eventId: 40, + eventId: 190, priority: events_emitter.EventPriority.LOW } console.info("[testSearch002] start to publish emit"); @@ -77,42 +77,6 @@ export default function searchJsunit() { let strJsonNew = getInspectorByKey('search'); let objNew = JSON.parse(strJsonNew); console.info("[testSearch002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.textFont).assertEqual('5'); - done(); - }); - - it('testSearch003', 0, async function (done) { - console.info('[testSearch003] START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('search'); - console.info("[testSearch003] component strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$attrs.searchButton).assertEqual('10'); - done(); - }); - - it('testSearch004', 0, async function (done) { - console.info('[testSearch004] START'); - await Utils.sleep(1000); - try { - var eventData = { - data: { - "searchButton": "5" - } - } - var innerEvent = { - eventId: 40, - priority: events_emitter.EventPriority.LOW - } - console.info("[testSearch004] start to publish emit"); - events_emitter.emit(innerEvent, eventData); - } catch (err) { - console.log("[testSearch004] change component data error: " + err.message); - } - await Utils.sleep(2000); - let strJsonNew = getInspectorByKey('search'); - let objNew = JSON.parse(strJsonNew); - console.info("[testSearch004] component objNew is: " + JSON.stringify(objNew)); expect(objNew.$attrs.searchButton).assertEqual('5'); done(); }); diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..9c6bdedac0ff62bf292c13113cacba911d61d50c --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets @@ -0,0 +1,79 @@ +// @ts-nocheck +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +export default function sourceTypeJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("sourceType beforeEach start"); + let options = { + uri: 'pages/sourceType', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get sourceType state pages:" + JSON.stringify(pages)); + if (!("sourceType" == pages.name)) { + console.info("get sourceType state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push sourceType page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push sourceType page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sourceType after each called"); + }); + + it('sourceTypeTest_0100', 0, async function (done) { + await Utils.sleep(1000) + let rect = await Utils.getComponentRect('button') + console.info("sourceTypeTest_0100 rectInfo is " + JSON.stringify(rect)); + let x_value = rect.left + (rect.right - rect.left) / 2 + let y_value = rect.top + (rect.bottom - rect.top) / 2 + console.info("sourceTypeTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); + let point: TouchObject = { + id: 1, x: x_value, y: y_value, type: TouchType.Down + } + var callback = (eventData) => { + console.info("sourceTypeTest_0100 get event state result is: " + JSON.stringify(eventData)); + let event = JSON.parse(eventData.data.event); + expect(event.source).assertEqual(0) + } + var innerEvent = { + eventId: 198, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("sourceTypeTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info('sourceTypeTest_0100 sendTouchEvent :' + sendTouchEvent(point)); + await Utils.sleep(1000) + console.info('sourceTypeTest_0100 testSendTouchEvent END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets similarity index 95% rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets rename to ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets index f22ec36fc812fdb8619c2eed435c3604d6c94af1..ff4f3106ed13ef10cdc020d2939a6d1c5c9bb20c 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets @@ -15,7 +15,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; -import events_emitter from '@ohos.events.emitter'; import Utils from './Utils'; export default function transFormJsunit() { diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Utils.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Utils.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f4b16d766f1feeb75edd8cc84cd1448d61e569a --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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. + */ + +export default class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/utils/Constants.ets b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/utils/Constants.ets new file mode 100755 index 0000000000000000000000000000000000000000..13a6c0d16e7277756efb5136ce8b02ac6b601d50 --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @ts-nocheck +/** + * 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/ace/ace_ets_component_two/entry/src/main/resources/base/element/color.json b/ace/ace_ets_component_two/entry/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_two/entry/src/main/resources/base/element/float.json b/ace/ace_ets_component_two/entry/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_two/entry/src/main/resources/base/element/string.json b/ace/ace_ets_component_two/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..ff4014526837abe1fd58255faac5456a6be449d0 --- /dev/null +++ b/ace/ace_ets_component_two/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_component_two/entry/src/main/resources/base/media/bg.jpg b/ace/ace_ets_component_two/entry/src/main/resources/base/media/bg.jpg new file mode 100755 index 0000000000000000000000000000000000000000..1aac600abd2087172801b50ab50356c11d81d2d1 Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/resources/base/media/bg.jpg differ diff --git a/ace/ace_ets_component_two/entry/src/main/resources/base/media/icon.png b/ace/ace_ets_component_two/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/resources/base/media/icon.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/resources/rawfile/ic_health_heart.png b/ace/ace_ets_component_two/entry/src/main/resources/rawfile/ic_health_heart.png new file mode 100755 index 0000000000000000000000000000000000000000..aa63cbe883ced8de7830006ef060fc3e3c70d5da Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/resources/rawfile/ic_health_heart.png differ diff --git a/ace/ace_ets_component_two/entry/src/main/resources/rawfile/test.png b/ace/ace_ets_component_two/entry/src/main/resources/rawfile/test.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_component_two/entry/src/main/resources/rawfile/test.png differ diff --git a/ace/ace_ets_component_two/signature/openharmony_sx.p7b b/ace/ace_ets_component_two/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/ace/ace_ets_component_two/signature/openharmony_sx.p7b differ