diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets index 58b597d821afe68dc65b28ef47009a94bc513ddc..f19739b63aebec767d8488758b7928b834a3c4bf 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets @@ -21,6 +21,7 @@ struct CanvasExample { private scroller: Scroller = new Scroller(); private settings: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + build() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { Scroll(this.scroller) { @@ -67,9 +68,22 @@ struct CanvasExample { this.createImageData(); this.createImageDataByImageData(); this.getImageData(); + this.putImageData(); + this.createLinearGradient(); + this.createRadialGradient(); + this.restore(); + this.save(); + this.addPath(); + this.lineDash(); + this.toDataURL(); + this.getWidth(); + this.getHeight(); + this.fill(); + this.textMetrics(); + this.getBitImageSize(); }) .key('canvas1') - }.width('100%').height('400%') + }.width('100%').height('350%') }.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) .scrollBarColor(Color.Gray).scrollBarWidth(10) } @@ -228,6 +242,11 @@ struct CanvasExample { this.context.imageSmoothingEnabled = false; this.context.drawImage( img, 30, 950, 160, 100); } + imageSmoothingQuality() { + let img = new ImageBitmap('/images/img.jpeg'); + this.context.imageSmoothingQuality('high'); + this.context.drawImage( img, 30, 950, 160, 100); + } fillRect() { this.context.fillRect(10, 1080, 80, 80); } @@ -244,7 +263,7 @@ struct CanvasExample { this.context.fillText("Hello World!", 120, 1200); } strokeText() { - this.context.font = '20px sans-serif' + this.context.font = '20px sans-serif'; this.context.strokeText("Hello World!", 260, 1195); } measureText() { @@ -320,6 +339,13 @@ struct CanvasExample { this.context.fillRect(0, 1650, 100, 100); this.context.setTransform(1, 0, 0, 1, 0, 0); } + getTransform() { + let data = this.context.getTransform(); + console.info("[canvas] get transform----" + data); + } + resetTransform() { + this.context.resetTransform(); + } translate() { this.context.fillRect(180, 1650, 50, 50); this.context.translate(50, 50); @@ -327,7 +353,7 @@ struct CanvasExample { } drawImage() { let img = new ImageBitmap('/images/img.jpeg'); - this.context.drawImage(img, 0, 0, 500, 500, 0, 1780, 300, 150); + this.context.drawImage(img, 0, 0, 500, 500, 0, 1780, 200, 100); } createImageData() { let imageData = this.context.createImageData(100, 100); @@ -342,4 +368,80 @@ struct CanvasExample { let imageData = this.context.getImageData(10, 10, 80, 80); console.info("[canvas] get image data-----" + JSON.stringify(imageData)); } + putImageData() { + let imageData = this.context.createImageData(80, 80); + for (var i = 0; i < imageData.data.length; i += 4) { + imageData.data[i + 0] = 255; + imageData.data[i + 1] = 0; + imageData.data[i + 2] = 255; + imageData.data[i + 3] = 255; + } + this.context.putImageData(imageData, 250, 1660); + } + createLinearGradient() { + let grad = this.context.createLinearGradient(50, 1900, 150, 2000); + grad.addColorStop(0.0, 'red'); + grad.addColorStop(0.5, 'white'); + grad.addColorStop(1.0, 'green'); + this.context.fillStyle = grad; + this.context.fillRect(10, 1900, 150, 150); + } + createRadialGradient() { + let grad = this.context.createRadialGradient(280, 1970, 40, 280, 1970, 80); + grad.addColorStop(0.0, 'red'); + grad.addColorStop(0.5, 'white'); + grad.addColorStop(1.0, 'green'); + this.context.fillStyle = grad; + this.context.fillRect(200, 1900, 150, 150); + this.context.closePath(); + } + restore() { + this.context.restore(); + } + save() { + this.context.save(); + } + addPath() { + let path2Da = new Path2D("M250 150 L150 350 L350 350 Z"); + let path2Db = new Path2D(); + path2Db.addPath(path2Da); + this.context.stroke(path2Db); + } + lineDash() { + this.context.beginPath(); + this.context.arc(20, 2130, 50, 0, 6.28); + this.context.setLineDash([10, 20]); + this.context.stroke(); + } + toDataURL() { + let dataUrl = this.context.toDataURL(); + console.info("[canvas] canvas rendering context2D toDataURL-----" + JSON.stringify(dataUrl)); + } + getWidth() { + let width = this.context.width; + console.info("[canvas] canvas width---" + width); + } + getHeight() { + let height = this.context.height; + console.info("[canvas] canvas height---" + height); + } + fill() { + this.context.beginPath(); + this.context.rect(130, 2080, 100, 100); + this.context.fill('nonzero'); + } + direction() { + this.context.direction('inherit'); + } + textMetrics() { + this.context.font = '20px sans-serif'; + this.context.fillText("Hello World!", 120, 2150); + let obj = this.context.measureText("Hello World!"); + console.info("[canvas] textMetrics info---" + JSON.stringify(obj)); + } + getBitImageSize() { + let img = new ImageBitmap('/images/img.jpeg'); + let width = img.width; + let height = img.height; + } } \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets new file mode 100755 index 0000000000000000000000000000000000000000..f50b17fc6701f5304c53026c113e1d2e9c193f7b --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets @@ -0,0 +1,58 @@ +/** + * 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 Canvas2Example { + private scroller: Scroller = new Scroller(); + private settings: RenderingContextSettings = new RenderingContextSettings(true); + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings); + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { + Scroll(this.scroller) { + Column() { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() => { + this.transferFromImageBitmap(); + this.offScreenToDataURL(); + }) + .key('canvas2') + }.width('100%').height('100%') + }.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) + .scrollBarColor(Color.Gray).scrollBarWidth(10) + } + .width('100%') + .height('100%') + } + onPageShow() { + } + transferFromImageBitmap() { + this.offContext.fillStyle = '#0000ff'; + this.offContext.fillRect(20, 160, 150, 100); + let image = this.offContext.transferToImageBitmap(); + this.context.transferFromImageBitmap(image); + } + offScreenToDataURL() { + let dataUrl = this.offContext.toDataURL(); + console.info("[canvas] offContext canvas rendering context2D toDataURL-----" + JSON.stringify(dataUrl)); + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets new file mode 100755 index 0000000000000000000000000000000000000000..cd17f181004621ff1aa4b1433767d0951e97c311 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets @@ -0,0 +1,46 @@ +/** + * 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 Canvas3Example { + private settings: RenderingContextSettings = new RenderingContextSettings(true); + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { + Column() { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() => { + this.rotate(); + }) + .key('canvas3') + }.width('100%').height('100%') + } + .width('100%') + .height('100%') + } + onPageShow() { + } + rotate() { + this.context.rotate(45 * Math.PI / 180); + this.context.fillRect(200, 20, 100, 100); + } +} \ 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 new file mode 100755 index 0000000000000000000000000000000000000000..60dbee71da1150994935cf11acfb6852649a72a8 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets @@ -0,0 +1,41 @@ +// @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/motionPath.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets new file mode 100755 index 0000000000000000000000000000000000000000..4f05c9681f306e1a7b48c6081b32809e39b016f4 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets @@ -0,0 +1,102 @@ +/** + * 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 MotionPathExample { + @State offsetX: number = 0 + @State offsetY: number = 0 + @State toggle: boolean = true + @State rotatable: boolean = false + @State path:string='Mstart.x start.y L300 200 L300 500 Lend.x end.y' + @State fromX:number = 0 + @State toY:number = 1 + + build() { + Column() { + Button('click me') + .key('button') + .motionPath({ path: this.path, from: this.fromX, to: this.toY, rotatable:this.rotatable }) + .onClick(() => { + this.rotatable = true; + console.info('button rotate current action state is:' + this.rotatable); + try { + var backData = { + data: { + "ACTION": this.rotatable, + } + } + var backEvent = { + eventId: 2, + priority: events_emitter.EventPriority.LOW + } + console.info("button start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button emit action state err: " + JSON.stringify(err.message)) + } + animateTo({ duration: 4000, curve: Curve.Linear }, () => { + this.toggle = !this.toggle; + }) + }) + .backgroundColor(0x317aff) + Button('next') + .key('button1') + .onClick(() => { + try { + var backData = { + data: { + "fromX": this.fromX, + "toY": this.toY + } + } + var backEvent = { + eventId: 3, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 position start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 position emit action state err: " + JSON.stringify(err.message)) + } + }) + } + .key('motionPath') + .width('100%').height('100%').alignItems(this.toggle ? HorizontalAlign.Start : HorizontalAlign.Center) + } + + onPageShow(){ + console.info('motionPath page show called'); + var stateChangeEvent = { + eventId:1, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent,this.stateChangeCallBack) + } + + private stateChangeCallBack = (eventData) =>{ + if(eventData != null){ + console.info('motionPath page state change called:' + JSON.stringify(eventData)); + if(eventData.data.fromX != null){ + this.fromX == parseInt(eventData.data.fromX); + } + if(eventData.data.toY != null){ + this.toY == parseInt(eventData.data.toY); + } + } + } +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets new file mode 100755 index 0000000000000000000000000000000000000000..b1519513d8ddf07aeb9091230a1df47355fb60e9 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets @@ -0,0 +1,55 @@ +// @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 GestureSettingsExample { + @State value: string = '' + build() { + Column() { + Text('Click\n' + this.value).gesture(TapGesture() + .onAction(() => { + this.value = 'gesture onAction' + try { + var backData = { + data: { + "value": this.value + } + } + var backEvent = { + eventId: 199, + 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('tapGesture') + } + .key('parallelGesture') + .height(200).width(300).padding(60).border({ width: 1 }).margin(30) + .priorityGesture( + TapGesture() + .onAction(() => { + this.value = 'parallelGesture onAction' + }), GestureMask.IgnoreInternal + ) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets new file mode 100755 index 0000000000000000000000000000000000000000..43267f8fed97daedaa629cce5d83b7c0a93f5356 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets @@ -0,0 +1,54 @@ +// @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 GestureSettingsExample { + @State value: string = '' + build() { + Column() { + Text('Click\n' + this.value).gesture(TapGesture() + .onAction(() => { + this.value = 'gesture onAction' + try { + var backData = { + data: { + "value": this.value + } + } + var backEvent = { + eventId: 111, + 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('tapGesture') + } + .height(200).width(300).padding(60).border({ width: 1 }).margin(30) + .priorityGesture( + TapGesture() + .onAction(() => { + this.value = 'priorityGesture onAction' + }), GestureMask.IgnoreInternal + ) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets new file mode 100755 index 0000000000000000000000000000000000000000..bf2ae193863861ffaa72332357d508e13df09235 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets @@ -0,0 +1,91 @@ +/** + * 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 RatingExample { + @State rating: number = 1 + @State indicator: boolean = false + + + private stateChangCallBack = (eventData) => { + console.info("rating page stateChangCallBack"); + if (eventData != null) { + console.info("rating page state change called:" + JSON.stringify(eventData.data.rating)); + if(eventData.data.rating != null) { + this.rating = eventData.data.rating; + } + } + } + + onPageShow() { + console.info('rating page show called'); + var stateChangeEvent = { + eventId: 440, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack) + + var stateChangeEventTwo = { + eventId: 441, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventTwo, this.stateChangCallBack) + + var stateChangeEventThree = { + eventId: 442, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventThree, this.stateChangCallBack) + + var stateChangeEventFour = { + eventId: 443, + 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, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventSix , this.stateChangCallBack) + + var stateChangeEventSeven = { + eventId: 445, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEventSeven , this.stateChangCallBack) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Text('current score is ' + this.rating).fontSize(20) + Rating({ rating: this.rating, indicator: this.indicator }) + .stars(5).key('Rating') + .stepSize(0.5) + .onChange((value: number) => { + this.rating = value + }) + }.width(350).height(200).padding(35) + } +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets new file mode 100755 index 0000000000000000000000000000000000000000..8dcfc3e388cb06f03a3be71f4510c6560a93b2ac --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets @@ -0,0 +1,141 @@ +// @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 scrollCode { + @State scrollable: ScrollDirection = ScrollDirection.Vertical; + @State scrollBar: BarState = BarState.On; + @State scrollBarColor: Color = "#FF0000FF"; + @State scrollBarWidth: number = 30; + + scroller: Scroller = new Scroller() + + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("scrollCode page state change called:" + JSON.stringify(eventData)); + var scrollableValue = eventData.data.scrollable; + console.info("scrollableValue:" + scrollableValue); + if (scrollableValue!= null && scrollableValue.length != 0) { + this.scrollable = scrollableValue; + console.info("this.scrollable:" + this.scrollable); + }else{ + console.info("scrollableValue is null or empty " + scrollableValue); + } + var scrollBarValue = eventData.data.scrollBar; + console.info("scrollBarValue:" + scrollBarValue); + if (scrollBarValue!= null && scrollBarValue.length != 0) { + this.scrollBar = scrollBarValue; + console.info("this.scrollBar:" + this.scrollBar); + }else{ + console.info("scrollBarValue is null or empty " + scrollBarValue); + } + var scrollBarColorValue = eventData.data.scrollBarColor; + console.info("scrollBarColorValue:" + scrollBarColorValue); + if (scrollBarColorValue!= null && scrollBarColorValue.length != 0) { + this.scrollBarColor = scrollBarColorValue; + console.info("this.scrollBarColor:" + this.scrollBarColor); + }else{ + console.info("scrollBarColorValue is null or empty " + scrollBarColorValue); + } + var scrollBarWidthValue = eventData.data.scrollBarWidth; + console.info("scrollBarWidthValue:" + scrollBarWidthValue); + if (scrollBarWidthValue!= null && scrollBarWidthValue.length != 0) { + this.scrollBarWidth = scrollBarWidthValue; + console.info("this.scrollBarWidth:" + this.scrollBarWidth); + }else{ + console.info("scrollBarWidthValue is null or empty " + scrollBarWidthValue); + } + } else { + console.info("scrollCode page color not change called:" + JSON.stringify(eventData)); + } + } + + onPageShow() { + console.info('scrollCode page show called'); + var stateChangeEvent = { + eventId: 90, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEvent = { + eventId: 80, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEvent = { + eventId: 85, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var stateChangeEvent = { + eventId: 95, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%').height(150).backgroundColor(0xFFFFFF) + .borderRadius(15).fontSize(16).textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .key("ScrollCode") + .scrollable(this.scrollable) + .scrollBar(this.scrollBar) + .scrollBarColor(this.scrollBarColor) + .scrollBarWidth(this.scrollBarWidth) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + + Button('scroll 100') + .onClick(() => { + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 }) + }) + .margin({ top: 10, left: 20 }) + Button('back top') + .onClick(() => { + this.scroller.scrollEdge(Edge.Top) + }) + .margin({ top: 60, left: 20 }) + Button('next page') + .onClick(() => { + this.scroller.scrollPage({ next: true }) + }) + .margin({ top: 110, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets new file mode 100755 index 0000000000000000000000000000000000000000..b78a44cd60d820ec9f7973e82397432174341435 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets @@ -0,0 +1,99 @@ +// @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 ShapeExample { + @State strokeDashOffset: numbert = 0; + @State strokeLineCap: LineCapStyle = LineCapStyle.Butt; + @State strokeLineJoin: LineJoinStyle = LineJoinStyle.Miter; + @State strokeMiterLimit: number = 4; + @State strokeOpacity: number = 1; + @State strokeWidth: number = 1; + @State antiAlias: boolean = true; + @State strokeDashArray: Array = [20]; + @State fillOpacity: number = 0; + + private stateChangCallBack = (eventData) => { + if (eventData != null) { + console.info("text page state change called:" + JSON.stringify(eventData)); + if (eventData.data.strokeDashOffset != null) { + this.strokeDashOffset = parseInt(eventData.data.strokeDashOffset); + } + if (eventData.data.strokeLineCap != null) { + this.strokeLineCap = eventData.data.strokeLineCap; + } + if (eventData.data.strokeLineJoin != null) { + this.strokeLineJoin = eventData.data.strokeLineJoin; + } + if (eventData.data.strokeMiterLimit != null) { + this.strokeMiterLimit = parseInt(eventData.data.strokeMiterLimit); + } + if (eventData.data.strokeOpacity != null) { + this.strokeOpacity = parseInt(eventData.data.strokeOpacity); + } + if (eventData.data.fillOpacity != null) { + this.fillOpacity = parseInt(eventData.data.fillOpacity); + } + if (eventData.data.antiAlias != null) { + this.antiAlias = eventData.data.antiAlias; + } + if (eventData.data.strokeDashArrayOne != null) { + this.strokeDashArray[0] = parseInt(eventData.data.strokeDashArrayOne); + } + if (eventData.data.strokeDashArrayTwo != null) { + this.strokeDashArray[1] = parseInt(eventData.data.strokeDashArrayTwo); + } + if (eventData.data.strokeDashArrayThree != null) { + this.strokeDashArray[2] = parseInt(eventData.data.strokeDashArrayThree); + } + } + } + + onPageShow() { + console.info('qrCode page show called'); + var stateChangeEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + build() { + Column({ space: 2 }) { + Text('basic').fontSize(30).fontColor(0xCCCCCC).width(320) + Shape() { + Rect().width(300).height(50) + Ellipse().width(300).height(50).offset({ x: 0, y: 60 }) + Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 }) + } + .key('shape') + .viewPort({ x: -2, y: -2, width: 304, height: 130 }) + .fill(0x317Af7) + .stroke(Color.Black) + .strokeDashArray(this.strokeDashArray) + .strokeDashOffset(this.strokeDashOffset) + .strokeLineCap(this.strokeLineCap) + .strokeLineJoin(this.strokeLineJoin) + .strokeMiterLimit(this.strokeMiterLimit) + .strokeOpacity(this.strokeOpacity) + .strokeWidth(this.strokeWidth) + .antiAlias(this.antiAlias) + .fillOpacity(this.fillOpacity) + }.width('100%').margin({ top: 15 }) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets new file mode 100755 index 0000000000000000000000000000000000000000..acae2f9c57b3876a8b39e0c0aa075859ecd3ba8b --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets @@ -0,0 +1,61 @@ +// @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 SpanExample { + @State decorationValue:object={ type: TextDecorationType.None, color: Color.Red } + @State textCaseValue:TextCase=TextCase.Normal + @State fontSizeValue:number=40 + + private stateChangCallBack = (eventData) => { + console.info("span page state change called:" + JSON.stringify(eventData)); + if (eventData != null) { + if (eventData.data.decorationValue != null) { + this.decorationValue = JSON.parse(eventData.data.decorationValue); + } + if (eventData.data.textCaseValue != null) { + this.textCaseValue = eventData.data.textCaseValue; + } + } + } + + onPageShow() { + console.info('span 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); + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { + Text('Basic Usage').fontSize(9).fontColor(0xCCCCCC) + Text() { + Span('This is the Span component').fontSize(this.fontSizeValue).textCase(this.textCaseValue) + .decoration(this.decorationValue).key('decoration') + } + }.width('100%').height(250).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/text.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets index 333e127d0bfb456a2d77882f136618f6fc715b39..e8c9bca721746cba39b8bfa0464f2a2a17837384 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets @@ -17,13 +17,15 @@ import events_emitter from '@ohos.emitter' @Entry @Component struct TextExample { -@State fontSize: number = 9 + @State fontSize: number = 9 build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('lineHeight') .fontSize(this.fontSize) .fontColor(0xCCCCCC) .key('text') + Image($rawfile('test.png')) + .key('image') } .height(600) .width(350) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets new file mode 100755 index 0000000000000000000000000000000000000000..11a755ec98072ee9c4e1ac36e83830405b98f451 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets @@ -0,0 +1,73 @@ +// @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 ToggleExample { + @State selectedColor : color = '#330A59F7'; + @State toggleType : ToggleType = ToggleType.Button; + @State isOn : boolean = false; + + onPageShow() { + console.info('[toggle] page show called'); + var stateChangeEvent = { + eventId: 1011, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[toggle] page stateChangCallBack"); + if (eventData != null) { + console.info("[toggle] page state change called:" + JSON.stringify(eventData)); + if(eventData.data.selectedColor != null) { + this.selectedColor = eventData.data.selectedColor; + } + if(eventData.data.toggleType != null) { + this.toggleType = eventData.data.toggleType; + } + if(eventData.data.isOn != null) { + this.isOn = eventData.data.isOn; + } + } + } + + build() { + Column({ space: 10 }) { + Text('type: Button').fontSize(12).fontColor(0xcccccc).width('90%').key('button') + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Toggle({ type: this.toggleType, isOn: this.isOn }) { + Text('status button').padding({ left: 12, right: 12 }) + } + .key('toggle') + .selectedColor(this.selectedColor) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + + Toggle({ type: ToggleType.Button, isOn: true }) { + Text('status button').padding({ left: 12, right: 12 }) + } + .selectedColor(0x39a2db) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + } + }.width('100%').padding(24) + } +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets new file mode 100755 index 0000000000000000000000000000000000000000..7bdd4c05b2b2a4cfca3434811353315207b72cd2 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets @@ -0,0 +1,63 @@ +/** + * 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 TransitionExample { + @State btn1: boolean = false + @State show: string = "show" + @State onActionCalled: boolean = false + @State transitionTypeOne: TransitionType = TransitionType.Insert + @State transitionTypeTwo: TransitionType = TransitionType.Delete + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) { + Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}).key('button') + .onClick(() => { + this.onActionCalled = true; + try { + var backData = { + data: { + "btn1": this.btn1, + } + } + var backEvent = { + eventId: 333, + priority: events_emitter.EventPriority.LOW + } + console.info("transitionTest_0200 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("transitionTest_0200 emit action state err: " + JSON.stringify(err.message)) + } + animateTo({ duration: 3000 }, () => { + this.btn1 = !this.btn1 + if(this.btn1){ + this.show = "hide" + }else{ + this.show = "show" + } + }) + }) + if (this.btn1) { + Button() { + Image($r('app.media.bg')).width("80%").height(300).key('image') + }.transition({ type: this.transitionTypeOne, scale: {x:0,y:1.0} }).key('button1') + .transition({ type: this.transitionTypeTwo, scale: { x: 1.0, y: 0.0 } }) + } + }.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/test/AnimateJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets index 0a8e346c757c38541ec5fb61d8d2f871b32c7cc6..1d02d8038133f55e7541db2457db029e565105ea 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets @@ -36,7 +36,7 @@ export default function animateJsunit() { console.info("push animate page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push animate page error:" + JSON.stringify(result)); + console.error("push animate page error:" + err); } done() }); @@ -46,151 +46,151 @@ export default function animateJsunit() { console.info("animate after each called"); }); -// it('animateTest_0100', 0, async function (done) { -// console.info('animateTest_0100 START'); -// await Utils.sleep(1500); -// let indexEvent = { -// eventId: 60, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.duration).assertEqual('100') -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0100 END'); -// done(); -// }); -// -// it('animateTest_0200', 0, async function (done) { -// console.info('animateTest_0200 START'); -// await Utils.sleep(1500); -// let indexEvent = { -// eventId: 61, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.curve).assertEqual('Ease') -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0200 END'); -// done(); -// }); -// -// it('animateTest_0300', 0, async function (done) { -// console.info('animateTest_0300 START'); -// await Utils.sleep(1500); -// let indexEvent = { -// eventId: 62, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.iteration).assertEqual('1') -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3',10,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0300 END'); -// done(); -// }); -// -// it('animateTest_0400', 0, async function (done) { -// console.info('animateTest_0400 START'); -// await Utils.sleep(1500); -// let indexEvent = { -// eventId: 63, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.tempo).assertEqual(1000) -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4',10,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0400 END'); -// done(); -// }); -// -// it('animateTest_0500', 0, async function (done) { -// console.info('animateTest_0500 START'); -// await Utils.sleep(1500); -// let indexEvent = { -// eventId: 64, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.playmode).assertEqual('normal') -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5',10,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0500 END'); -// done(); -// }); -// -// it('animateTest_0600', 0, async function (done) { -// console.info('animateTest_0500 START'); -// try { -// let eventData = { -// data: { -// "duration":'2000' -// } -// } -// let indexEventOne = { -// eventId: 65, -// priority: events_emitter.EventPriority.LOW -// } -// console.info("animateTest_0600 start to publish emit"); -// events_emitter.emit(indexEventOne, eventData); -// } catch (err) { -// console.log("animateTest_0600 change component data error: " + err.message); -// } -// let indexEvent = { -// eventId: 60, -// priority: events_emitter.EventPriority.LOW -// } -// let callback= (indexEvent) => { -// console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent)) -// except(indexEvent.data.duration).assertEqual('2000') -// } -// try { -// events_emitter.on(indexEvent, callback); -// } catch (err) { -// console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err)); -// } -// console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1',10 ,""))); -// await Utils.sleep(2000); -// console.info('animateTest_0600 END'); -// done(); -// }); + it('animateTest_0100', 0, async function (done) { + console.info('animateTest_0100 START'); + await Utils.sleep(1500); + let indexEvent = { + eventId: 60, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.duration).assertEqual('100') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); + await Utils.sleep(2000); + console.info('animateTest_0100 END'); + done(); + }); + + it('animateTest_0200', 0, async function (done) { + console.info('animateTest_0200 START'); + await Utils.sleep(1500); + let indexEvent = { + eventId: 61, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.curve).assertEqual('Ease') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,""))); + await Utils.sleep(2000); + console.info('animateTest_0200 END'); + done(); + }); + + it('animateTest_0300', 0, async function (done) { + console.info('animateTest_0300 START'); + await Utils.sleep(1500); + let indexEvent = { + eventId: 62, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.iteration).assertEqual('1') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3',10,""))); + await Utils.sleep(2000); + console.info('animateTest_0300 END'); + done(); + }); + + it('animateTest_0400', 0, async function (done) { + console.info('animateTest_0400 START'); + await Utils.sleep(1500); + let indexEvent = { + eventId: 63, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.tempo).assertEqual(1000) + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4',10,""))); + await Utils.sleep(2000); + console.info('animateTest_0400 END'); + done(); + }); + + it('animateTest_0500', 0, async function (done) { + console.info('animateTest_0500 START'); + await Utils.sleep(1500); + let indexEvent = { + eventId: 64, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.playmode).assertEqual('normal') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5',10,""))); + await Utils.sleep(2000); + console.info('animateTest_0500 END'); + done(); + }); + + it('animateTest_0600', 0, async function (done) { + console.info('animateTest_0500 START'); + try { + let eventData = { + data: { + "duration":'2000' + } + } + let indexEventOne = { + eventId: 65, + priority: events_emitter.EventPriority.LOW + } + console.info("animateTest_0600 start to publish emit"); + events_emitter.emit(indexEventOne, eventData); + } catch (err) { + console.log("animateTest_0600 change component data error: " + err.message); + } + let indexEvent = { + eventId: 60, + priority: events_emitter.EventPriority.LOW + } + let callback= (indexEvent) => { + console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent)) + except(indexEvent.data.duration).assertEqual('2000') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1',10 ,""))); + await Utils.sleep(2000); + console.info('animateTest_0600 END'); + done(); + }); it('animateTest_0700', 0, async function (done) { console.info('animateTest_0700 START'); 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 307544f270ed06b458087ad148b4f20dab504b77..0d3da54799e402978dbfe1e0af0c97514bf0718b 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 @@ -37,7 +37,7 @@ export default function appearJsunit() { console.info("push appear page result: " + JSON.stringify(result)); } } catch (err) { - console.error("push appear page error: " + JSON.stringify(result)); + console.error("push appear page error: " + err); } 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 fabc107d673f8689f155f3d5573967f87d977ff9..6bf942edd193f8ba48e779c15a98b6ec7a1b7634 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 @@ -35,7 +35,7 @@ export default function areaChangeJsunit() { console.info("push areaChange page success " + JSON.stringify(result)); } } catch (err) { - console.error("push areaChange page error " + JSON.stringify(result)); + console.error("push areaChange page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets index 034ee47fbdb65011f80b52c5b70846193a6e6f69..b8a8d83cdfcfe5aa0c610511153a464a109c502d 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets @@ -37,7 +37,7 @@ export default function badgeJsunit() { console.info("push badge page result: " + JSON.stringify(result)); } } catch (err) { - console.error("push badge page error: " + JSON.stringify(result)); + console.error("push badge page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets index 69d356785b3d98987d56594187c22cbfd117c044..3d5b423e03ad01e91fbae8a3364cbe1476788730 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets @@ -37,7 +37,7 @@ export default function buttonJsunit() { console.info("push button page result: " + JSON.stringify(result)); } } catch (err) { - console.error("push button page error: " + JSON.stringify(result)); + console.error("push button page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..70c852a6d382fd210eb75ca8d37850911f97b70e --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets @@ -0,0 +1,56 @@ +// @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 canvasJsunit() { + describe('canvasTest', function () { + beforeEach(async function (done) { + console.info("canvas beforeEach start"); + let options = { + uri: 'pages/canvas2', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get canvas2 state pages:" + JSON.stringify(pages)); + if (!("canvas2" == pages.name)) { + console.info("get canvas2 state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push canvas2 page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push canvas page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("canvas2 after each called"); + }); + + it('testCanvas01', 0, async function (done) { + console.info('[testCanvas01] START'); + await Utils.sleep(1000); + console.info('[testCanvas01]----------- START'); + console.info('testCanvas01 END'); + done(); + }); + }); +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..2724ffd468a454b98d54611bc9370fe7ae29aa60 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets @@ -0,0 +1,56 @@ +// @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 canvasJsunit() { + describe('canvas3Test', function () { + beforeEach(async function (done) { + console.info("canvas3 beforeEach start"); + let options = { + uri: 'pages/canvas3', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get canvas3 state pages:" + JSON.stringify(pages)); + if (!("canvas3" == pages.name)) { + console.info("get canvas3 state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push canvas3 page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push canvas3 page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("canvas3 after each called"); + }); + + it('testCanvas01', 0, async function (done) { + console.info('[testCanvas01] START'); + await Utils.sleep(1000); + console.info('[testCanvas01]----------- START'); + console.info('testCanvas01 END'); + done(); + }); + }); +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets index a644848ef1bef4f055863a2daf576d1744fa2f22..9404d0ff12948ef1f687bbf2bf5211576f3b122b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.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.emitter'; import Utils from './Utils'; export default function canvasJsunit() { @@ -36,7 +35,7 @@ export default function canvasJsunit() { console.info("push canvas page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push canvas page error:" + JSON.stringify(result)); + console.error("push canvas page error:" + err); } done() }); @@ -50,10 +49,6 @@ export default function canvasJsunit() { console.info('[testCanvas01] START'); await Utils.sleep(1000); console.info('[testCanvas01]----------- START'); - - let strJson = getInspectorByKey('canvas1'); - let obj = JSON.parse(strJson); - console.info("[testCanvas01] obj is: " + JSON.stringify(obj)); console.info('testCanvas01 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 new file mode 100755 index 0000000000000000000000000000000000000000..6c3f4519d99a74826cc7cff4397cc2161a36c3b8 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets @@ -0,0 +1,58 @@ +// @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/CommonJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..960348eee06a432f678c9f4ddf173db35032bb9e --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets @@ -0,0 +1,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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" + +export default function commonJsunit() { + describe('commonTest', function () { + it('commonTest_0100', 0, async function (done) { + console.info('commonTest_0100 START'); + var a = 90; + var b = vp2px(a); + console.info('commonTest_0100 vp2px result:' + b); + expect(b == 90).assertTrue(); + console.info('commonTest_0100 END'); + done(); + }); + + it('commonTest_0200', 0, async function (done) { + console.info('commonTest_0200 START'); + var a = -90; + var b = vp2px(a); + console.info('commonTest_0200 vp2px result:' + b); + expect(b == -90).assertTrue(); + console.info('commonTest_0200 END'); + done(); + }); + + it('commonTest_0300', 0, async function (done) { + console.info('commonTest_0300 START'); + var a = '30'; + var b = vp2px(a); + console.info('commonTest_0300 vp2px result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_0300 END'); + done(); + }); + + it('commonTest_0400', 0, async function (done) { + console.info('commonTest_0400 START'); + var a = 80; + var b = px2vp(a); + console.info('commonTest_0400 px2vp result:' + b); + expect(b == 80).assertTrue(); + console.info('commonTest_0400 END'); + done(); + }); + + it('commonTest_0500', 0, async function (done) { + console.info('commonTest_0500 START'); + var a = -800000000; + var b = px2vp(a); + console.info('commonTest_0500 px2vp result:' + b); + expect(b == -800000000).assertTrue(); + console.info('commonTest_0500 END'); + done(); + }); + + it('commonTest_0600', 0, async function (done) { + console.info('commonTest_0600 START'); + var a = '80'; + var b = px2vp(a); + console.info('commonTest_0600 px2vp result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_0600 END'); + done(); + }); + + it('commonTest_0700', 0, async function (done) { + console.info('commonTest_0700 START'); + var a = 70; + var b = fp2px(a); + console.info('commonTest_0700 fp2px result:' + b); + expect(b == 70).assertTrue(); + console.info('commonTest_0700 END'); + done(); + }); + + it('commonTest_0800', 0, async function (done) { + console.info('commonTest_0800 START'); + var a = -7000000000000; + var b = fp2px(a); + console.info('commonTest_0800 fp2px result:' + b); + expect(b == -2147483648).assertTrue(); + console.info('commonTest_0800 END'); + done(); + }); + + it('commonTest_0900', 0, async function (done) { + console.info('commonTest_0900 START'); + var a = '70'; + var b = fp2px(a); + console.info('commonTest_0900 fp2px result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_0900 END'); + done(); + }); + + it('commonTest_1000', 0, async function (done) { + console.info('commonTest_1000 START'); + var a = 60; + var b = px2fp(a); + console.info('commonTest_1000 px2fp result:' + b); + expect(b == 60).assertTrue(); + console.info('commonTest_1000 END'); + done(); + }); + + it('commonTest_1100', 0, async function (done) { + console.info('commonTest_1100 START'); + var a = -6000000000; + var b = px2fp(a); + console.info('commonTest_1100 px2fp result:' + b); + expect(b == -6000000000).assertTrue(); + console.info('commonTest_1100 END'); + done(); + }); + + it('commonTest_1200', 0, async function (done) { + console.info('commonTest_1200 START'); + var a = '60'; + var b = px2fp(a); + console.info('commonTest_1200 px2fp result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_1200 END'); + done(); + }); + + it('commonTest_1300', 0, async function (done) { + console.info('commonTest_1300 START'); + var a = 50; + var b = lpx2px(a); + console.info('commonTest_1300 lpx2px result:' + b); + expect(b == 33).assertTrue(); + console.info('commonTest_1300 END'); + done(); + }); + + it('commonTest_1400', 0, async function (done) { + console.info('commonTest_1400 START'); + var a = -500000000; + var b = lpx2px(a); + console.info('commonTest_1400 lpx2px result:' + b); + expect(b == -333333343).assertTrue(); + console.info('commonTest_1400 END'); + done(); + }); + + it('commonTest_1500', 0, async function (done) { + console.info('commonTest_1500 START'); + var a = '50'; + var b = lpx2px(a); + console.info('commonTest_1500 lpx2px result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_1500 END'); + done(); + }); + + it('commonTest_1600', 0, async function (done) { + console.info('commonTest_1600 START'); + var a = 40; + var b = px2lpx(a); + console.info('commonTest_1600 px2lpx result:' + b); + expect(b == 59.99999821186071).assertTrue(); + console.info('commonTest_1600 END'); + done(); + }); + + it('commonTest_1700', 0, async function (done) { + console.info('commonTest_1700 START'); + var a = -400000; + var b = px2lpx(a); + console.info('commonTest_1700 px2lpx result:' + b); + expect(b == -599999.9821186071).assertTrue(); + console.info('commonTest_1700 END'); + done(); + }); + + it('commonTest_1800', 0, async function (done) { + console.info('commonTest_1800 START'); + var a = '40'; + var b = px2lpx(a); + console.info('commonTest_1800 px2lpx result:' + b); + expect(b == undefined).assertTrue(); + console.info('commonTest_1800 END'); + done(); + }); + }) +} \ No newline at end of file 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 5871c8f1d19cfcd1208c213db097d8677c02a11b..d51a990aa2fff24ac5618bc00c757fa4b8cb9501 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 @@ -36,7 +36,7 @@ export default function ellipseJsunit() { console.info("push ellipse page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push ellipse page error:" + JSON.stringify(result)); + console.error("push ellipse page error:" + err); } 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 eadc84459b8588ad80e469a249f0028d7a078af1..7a4703ff2fc59f1543bbbc460024c6ab85469f02 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 @@ -36,7 +36,7 @@ export default function enableJsunit() { console.info("push enable page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push enable page error:" + JSON.stringify(result)); + console.error("push enable page error:" + err); } done() }); 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 6243a1e820db91650cd13d9885a2938821a650a1..8cd3696cad429d3e5d943e4c7fae3de2d26e5958 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 @@ -35,7 +35,7 @@ export default function gaugeJsunit() { console.info("push gauge page success " + JSON.stringify(result)); } } catch (err) { - console.error("push gauge page error " + JSON.stringify(err)); + console.error("push gauge page error " + err); } done() }); @@ -65,10 +65,7 @@ export default function gaugeJsunit() { try { var eventData = { data: { - "gaugeValue": "10", - "strokeWidthValue": "30", - "startAngleValue": "200", - "endAngleValue": "200" + "gaugeValue": "10" } } var innerEvent = { @@ -84,8 +81,7 @@ export default function gaugeJsunit() { let strJsonNew = getInspectorByKey('gauge'); let objNew = JSON.parse(strJsonNew); console.info("[testGauge002] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.strokeWidth).assertEqual('30.000000vp'); - expect(objNew.$attrs.value).assertEqual('10.00'); + expect(objNew.$attrs.gauge).assertEqual('10.00'); done(); }); @@ -95,11 +91,11 @@ export default function gaugeJsunit() { try { var eventData = { data: { - "colorValues": JSON.stringify([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1]]) + "strokeWidthValue": "30", } } var innerEvent = { - eventId: 2, + eventId: 1, priority: events_emitter.EventPriority.LOW } console.info("[testGauge003] start to publish emit"); @@ -107,6 +103,84 @@ export default function gaugeJsunit() { } 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.000000vp'); + 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(); }); }) 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 bee28d777aa31c56746fb4044e71c144be4bbeba..7546cdd0a664393e00150c33613856dccaea9389 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 @@ -36,7 +36,7 @@ export default function girdContainerJsunit() { console.info("push girdContainer page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push girdContainer page error:" + JSON.stringify(result)); + console.error("push girdContainer page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets index 051f33dc4dd1677d5404c9a920fa87ebedb3c766..f1bebad7f6ab91b14d30bcb7c24f12389486d756 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets @@ -36,7 +36,7 @@ export default function gridJsunit() { console.info('beforeEach push prompt page result:' + JSON.stringify(result)); } } catch (err) { - console.error('beforeEach push prompt page error:' + JSON.stringify(result)); + console.error('beforeEach push prompt page error:' + err); } done() }); 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 3a2031dd3ae2fd4e7979604426a46759c2992a9a..6e598a6d05e82f352b0cd523091a05bd6074d283 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,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,7 +38,7 @@ 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 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'; @@ -56,6 +55,19 @@ 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 canvas3Jsunit from './Canvas3Jsunit.test.ets'; +import transitionJsunit from './TransitionJsunit.test.ets'; +import priorityGestureJsunit from './PriorityGestureJsunit.test.ets'; +import parallelGestureJsunit from './ParallelGestureJsunit.test.ets'; export default function testsuite() { gaugeJsunit(); @@ -92,6 +104,8 @@ export default function testsuite() { textJsunit(); badgeJsunit(); canvasJsunit(); + canvas2Jsunit(); + canvas3Jsunit(); longPressGestureJsUnit(); buttonJsunit(); responseRegionJsunit(); @@ -101,4 +115,15 @@ export default function testsuite() { tapGesture(); progressJsunit(); animateJsunit(); + commonJsunit(); + spanJsunit(); + ratingJsunit(); + toggleJsunit(); + shapeJsunit(); + motionPathJsunit(); + columnJsunit(); + scrollCodeJsunit(); + transitionJsunit(); + priorityGestureJsunit(); + parallelGestureJsunit(); } \ 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 6aa925724d1ff142cce75c5b3ce0f0473b6fd5ad..84609ff604a1839321f218eac7b7b1d5bff42fbb 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 @@ -36,7 +36,7 @@ export default function listJsunit() { console.info("push list page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push list page error:" + JSON.stringify(result)); + console.error("push list page error:" + err); } done() }); @@ -69,10 +69,7 @@ export default function listJsunit() { try { var eventData = { data: { - "listDirection": Axis.Horizontal, - "editMode": true, - "edgeEffect": EdgeEffect.Spring, - "chainAnimation": true + "listDirection": Axis.Horizontal } } var innerEvent = { @@ -89,9 +86,6 @@ export default function listJsunit() { let obj = JSON.parse(strJson); console.info("[testList02] obj is: " + JSON.stringify(obj)); expect(obj.$attrs.listDirection).assertEqual('Axis.Horizontal'); - expect(obj.$attrs.editMode).assertEqual('true'); - expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.Spring'); - expect(obj.$attrs.chainAnimation).assertEqual('true'); console.info('testList02 END'); done(); }); @@ -101,14 +95,11 @@ export default function listJsunit() { try { var eventData = { data: { - "strokeWidth": "3.000000vp", - "color": "#FF0000FF", - "startMargin": "30.000000vp", - "endMargin": "30.000000vp" + "editMode": true } } var innerEvent = { - eventId: 81, + eventId: 80, priority: events_emitter.EventPriority.LOW } console.info("[testList03] start to publish emit:" + JSON.stringify(eventData.data)); @@ -116,15 +107,168 @@ export default function listJsunit() { } catch (err) { console.log("[testList03] change component data error: " + err.message); } - await Utils.sleep(1000); + 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('testList03 END'); + console.info('testList09 END'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets index 54b5fdbc7d561b074314e79c919a41c0ab226e47..18f49d43460765e1ab4dd48a97e16c288ef9ab27 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets @@ -36,7 +36,7 @@ export default function longPressGestureJsunit() { console.info("push longPressGesture page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push longPressGesture page error:" + JSON.stringify(result)); + console.error("push longPressGesture page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f4c56998d10064cb40e6f3bae175d28ce4e145e5 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets @@ -0,0 +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 {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 motionPathJsunit() { + describe('motionPathTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/motionPath', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get motionPath state success " + JSON.stringify(pages)); + if (!("motionPath" == pages.name)) { + console.info("get motionPath state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push motionPath page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push motionPath page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("motionPath after each called"); + }); + + it('motionPathTest_0100', 0, async function (done) { + console.info('motionPathTest_0100 START'); + let strJson = getInspectorByKey('motionPath'); + console.info("motionPathTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("motionPathTest_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Column'); + done(); + }); + + it('motionPathTest_0200', 0, async function (done) { + console.info('motionPathTest_0200 START'); + let callback = (indexEventOne) => { + console.info("motionPathTest_0200 get state result is: " + JSON.stringify(indexEventOne)); + expect(indexEventOne.data.fromX).assertEqual(0); + expect(indexEventOne.data.toY).assertEqual(1); + } + let indexEventOne = { + eventId: 3, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEventOne, callback); + } catch (err) { + console.info("motionPathTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("motionPathTest_0200 click result is: " + JSON.stringify(sendEventByKey('button1',10,""))); + await Utils.sleep(1000); + console.info('motionPathTest_0200 END'); + done(); + }); + + it('motionPathTest_0300', 0, async function (done) { + console.info('motionPathTest_0300 START'); + await Utils.sleep(1500); + let callback = (indexEvent) => { + console.info("motionPathTest_0300 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.ACTION).assertEqual(true); + } + let indexEvent = { + eventId: 2, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("motionPathTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("motionPathTest_0300 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + console.info('motionPathTest_0300 END'); + done(); + }); + }) +} 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 781c2171425308f29c9704da4a09306a951087fd..024e066a3c2cfde9160c4d42a3aa9c90209cb8cb 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 @@ -36,7 +36,7 @@ export default function enableJsunit() { console.info("push overlay page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push overlay page error:" + JSON.stringify(result)); + console.error("push overlay page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..5f0851e1c7deaa08f22af4f3b2c1342985fb722d --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets @@ -0,0 +1,76 @@ +// @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 parallelGestureJsunit() { + describe('parallelGestureTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/parallelGesture', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get parallelGesture state success " + JSON.stringify(pages)); + if (!("parallelGesture" == pages.name)) { + console.info("get parallelGesture state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push parallelGesture page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push parallelGesture page error " + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("parallelGesture after each called"); + }); + + it('parallelGestureTest_0100', 0, async function (done) { + await Utils.sleep(1000) + let rect = await Utils.getComponentRect('tapGesture') + console.info("parallelGestureTest_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("parallelGestureTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); + let point: TouchObject = { id: 11, x: x_value, y: y_value, type: TouchType.DOWN} + var callback = (eventData) => { + console.info("parallelGestureTest_0100 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('gesture onAction') + } + var innerEvent = { + eventId: 199, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("parallelGestureTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info('parallelGestureTest_0100 sendTouchEvent result:' + sendTouchEvent(point)); + await Utils.sleep(1000) + console.info('parallelGestureTest_0100 testSendTouchEvent END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..e2f2300440636d3280cf7871d93e4402d4f87856 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets @@ -0,0 +1,75 @@ +// @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 priorityGestureJsunit() { + describe('PriorityGestureTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/priorityGesture', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get priorityGesture state success " + JSON.stringify(pages)); + if (!("priorityGesture" == pages.name)) { + console.info("get priorityGesture state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push priorityGesture page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push priorityGesture page error " + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("priorityGesture after each called"); + }); + + it('priorityGestureTest_0100', 0, async function (done) { + await Utils.sleep(1000) + let rect = await Utils.getComponentRect('tapGesture') + console.info("priorityGestureTest_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("priorityGestureTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value); + let point: TouchObject = { id: 11, x: x_value, y: y_value, type: TouchType.Move} + var callback = (eventData) => { + console.info("priorityGestureTest_0100 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('gesture onAction') + } + var innerEvent = { + eventId: 111, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("priorityGestureTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info('priorityGestureTest_0100 sendTouchEvent one:' + sendTouchEvent(point)); + await Utils.sleep(1000) + console.info('priorityGestureTest_0100 testSendTouchEvent END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets index 20912302102ad66e89066b07f8f98ab4e40d2189..fd828a97a6aeef27e0a3a875e8bb3efe3f8112b8 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.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"); @@ -34,7 +35,7 @@ export default function progressJsunit() { console.info("push progress page success " + JSON.stringify(result)); } } catch (err) { - console.error("push progress page error " + JSON.stringify(err)); + console.error("push progress page error " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets index 949cccbfc9d7a362cd1b74426dc36dfcd18a5f74..4d85bdc8088235d56a1d5d55471dbc3751e5caff 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets @@ -35,7 +35,7 @@ export default function qrCodeJsunit() { console.info("push QrCode page success " + JSON.stringify(result)); } } catch (err) { - console.error("push QrCode page error " + JSON.stringify(err)); + console.error("push QrCode page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..92a5b1a42e953321fc899b12e2172f4d13f624fc --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets @@ -0,0 +1,221 @@ +/** + * 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 ratingJsunit() { + describe('ratingTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/rating', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get rating state success " + JSON.stringify(pages)); + if (!("rating" == pages.name)) { + console.info("get rating state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(4000); + console.info("push rating page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push rating page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("rating after each called"); + }); + + it('testRating_100', 0, async function (done) { + console.info('testRating_100 START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "rating": 2 + } + } + var innerEvent = { + eventId: 440, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_100 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_100 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_100 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("2.000000"); + console.info('testRating_100 END'); + done(); + }); + + it('testRating_200', 0, async function (done) { + console.info('[testRating_200] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.stepSize).assertEqual("0.500000"); + console.info('testRating_200 END'); + done(); + }); + + it('testRating_300', 0, async function (done) { + console.info('testRating_300 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "rating": 3 + } + } + var innerEvent = { + eventId: 441, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_300 start to publish emit"); + console.info("eventData.data.rating value" + eventData.data.rating); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_300 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("3.000000"); + console.info('testRating_300 END'); + done(); + }); + + it('testRating_400', 0, async function (done) { + console.info('testRating_400 START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "rating": 4 + } + } + var innerEvent = { + eventId: 442, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_400 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_400 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_400 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("4.000000"); + console.info('testRating_400 END'); + done(); + }); + + it('testRating_500', 0, async function (done) { + console.info('testRating_500 START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "rating": 5 + } + } + var innerEvent = { + eventId: 443, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_500 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_500 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_500 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("5.000000"); + console.info('testRating_500 END'); + done(); + }); + + it('testRating_600', 0, async function (done) { + console.info('testRating_600 START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "rating": 0 + } + } + var innerEvent = { + eventId: 444, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_600 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_600 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_600 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("0.000000"); + console.info('testRating_600 END'); + done(); + }); + + it('testRating_700', 0, async function (done) { + console.info('testRating_700 START'); + await Utils.sleep(1000); + try { + let eventData = { + data: { + "rating": 1 + } + } + var innerEvent = { + eventId: 445, + priority: events_emitter.EventPriority.LOW + } + console.info("testRating_700 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("testRating_700 change component data error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('Rating'); + let obj = JSON.parse(strJson); + console.info("testRating_700 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.rating).assertEqual("1.000000"); + console.info('testRating_700 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..2030653e1941779a5a62876dbdf2c0156540b3ba --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets @@ -0,0 +1,167 @@ +// @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 scrollCodeJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/scrollCode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get ScrollCode state success " + JSON.stringify(pages)); + if (!("ScrollCode" == pages.name)) { + console.info("get ScrollCode pages success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push ScrollCode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ScrollCode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("ScrollCode after each called"); + }); + + it('test_scrollCode_001', 0, async function (done) { + console.info('[test_scrollCode_001] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('ScrollCode'); + 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.Vertical'); + expect(obj.$attrs.scrollBar).assertEqual('BarState.On'); + expect(obj.$attrs.scrollBarColor).assertEqual('#FF0000FF'); + expect(obj.$attrs.scrollBarWidth).assertEqual('30.000000px'); + done(); + }); + + it('test_scrollCode_002', 0, async function (done) { + console.info('[test_scrollCode_002] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "scrollable": "ScrollDirection.Vertical" + } + } + var innerEvent = { + eventId: 90, + priority: events_emitter.EventPriority.LOW + } + console.info("[test_scrollCode_002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[test_scrollCode_002] change scrollable error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScrollCode'); + let obj = JSON.parse(strJson); + console.info("[test_scrollCode_002] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical'); + done(); + }); + + it('test_scrollCode_003', 0, async function (done) { + console.info('[test_scrollCode_003] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "scrollBar": "BarState.Off" + } + } + var innerEvent = { + eventId: 80, + priority: events_emitter.EventPriority.LOW + } + console.info("[test_scrollCode_003] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[test_scrollCode_003] change scrollBar error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScrollCode'); + let obj = JSON.parse(strJson); + console.info("[test_scrollCode_003] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.scrollBar).assertEqual('BarState.Off'); + done(); + }); + + it('test_scrollCode_004', 0, async function (done) { + console.info('[test_scrollCode_004] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "scrollBarColor": "#FFB6C1" + } + } + var innerEvent = { + eventId: 85, + priority: events_emitter.EventPriority.LOW + } + console.info("[test_scrollCode_004] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[test_scrollCode_004] change scrollBar error: " + err.message); + } + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScrollCode'); + let obj = JSON.parse(strJson); + console.info("[test_scrollCode_004] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.scrollBarColor).assertEqual('#FFFFB6C1'); + done(); + }); + + it('test_scrollCode_005', 0, async function (done) { + console.info('[test_scrollCode_005] START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "scrollBarWidth": 40 + } + } + var innerEvent = { + eventId: 95, + priority: events_emitter.EventPriority.LOW + } + console.info("[test_scrollCode_005] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[test_scrollCode_005] change scrollBar error: " + err.message); + } + await Utils.sleep(2000); + 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'); + 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/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8fbdc64f37b9fdb05a45d9f5ede951432b0ac231 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets @@ -0,0 +1,670 @@ +// @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 {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 shapeJsunit() { + describe('shapeTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/shape', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get shape state success " + JSON.stringify(pages)); + if (!("shape" == pages.name)) { + console.info("get shape state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push shape page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push shape page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("shape after each called"); + }); + + it('shapeTest_0100', 0, async function (done) { + console.info('shapeTest_0100 START'); + await Utils.sleep(1000); + 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'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0200', 0, async function (done) { + console.info('shapeTest_0200 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0200 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.strokeLineCap).assertEqual('LineCapStyle.Butt'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0300', 0, async function (done) { + console.info('shapeTest_0300 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0300 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0400', 0, async function (done) { + console.info('shapeTest_0400 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0400 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0500', 0, async function (done) { + console.info('shapeTest_0500 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0500 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.strokeOpacity).assertEqual('1.000000'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0600', 0, async function (done) { + console.info('shapeTest_0600 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0600 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.fillOpacity).assertEqual('0.000000'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0700', 0, async function (done) { + console.info('shapeTest_0700 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('shape'); + let obj = JSON.parse(strJson); + console.info("shapeTest_0700 component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.antiAlias).assertEqual('true'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0800', 0, async function (done) { + console.info('shapeTest_0800 START'); + await Utils.sleep(1000); + 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'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_0900', 0, async function (done) { + console.info('shapeTest_0900 START'); + await Utils.sleep(1000); + 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'); + await Utils.sleep(1000); + done(); + }); + + it('shapeTest_1000', 0, async function (done) { + console.info('shapeTest_1000 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "antiAlias": "false", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1000 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1000 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1000 component obj is: " + JSON.stringify(obj.$attrs.antiAlias)); + expect(obj.$attrs.antiAlias).assertEqual('false'); + done(); + }); + + it('shapeTest_1100', 0, async function (done) { + console.info('shapeTest_1100 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "antiAlias": aaaaa, + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1100 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1100 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1100 component obj is: " + JSON.stringify(obj.$attrs.antiAlias)); + expect(obj.$attrs.antiAlias).assertEqual('false'); + done(); + }); + + it('shapeTest_1200', 0, async function (done) { + console.info('shapeTest_1200 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "antiAlias": -0.1, + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1200 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1200 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1200 component obj is: " + JSON.stringify(obj.$attrs.antiAlias)); + expect(obj.$attrs.antiAlias).assertEqual('false'); + done(); + }); + + it('shapeTest_1300', 0, async function (done) { + console.info('shapeTest_1300 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineCap": LineCapStyle.Round, + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1300 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1300 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1300 component obj is: " + JSON.stringify(obj.$attrs.strokeLineCap)); + expect(obj.$attrs.strokeLineCap).assertEqual('LineCapStyle.Round'); + done(); + }); + + it('shapeTest_1400', 0, async function (done) { + console.info('shapeTest_1400 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineCap": 'string' + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1400 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1400 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1400 component obj is: " + JSON.stringify(obj.$attrs.strokeLineCap)); + expect(obj.$attrs.strokeLineCap).assertEqual('LineCapStyle.Butt'); + done(); + }); + + it('shapeTest_1500', 0, async function (done) { + console.info('shapeTest_1500 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineCap": '-0.2' + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1500 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1500 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1500 component obj is: " + JSON.stringify(obj.$attrs.strokeLineCap)); + expect(obj.$attrs.strokeLineCap).assertEqual('LineCapStyle.Butt'); + done(); + }); + + it('shapeTest_1600', 0, async function (done) { + console.info('shapeTest_1600 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineJoin": LineJoinStyle.Round, + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1600 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1600 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1600 component obj is: " + JSON.stringify(obj.$attrs.strokeLineJoin)); + expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Round'); + done(); + }); + + it('shapeTest_1700', 0, async function (done) { + console.info('shapeTest_1700 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineJoin": 'nothing', + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1700 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1700 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1700 component obj is: " + JSON.stringify(obj.$attrs.strokeLineJoin)); + expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter'); + done(); + }); + + it('shapeTest_1800', 0, async function (done) { + console.info('shapeTest_1800 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeLineJoin": 0.11111, + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1800 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1800 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1800 component obj is: " + JSON.stringify(obj.$attrs.strokeLineJoin)); + expect(obj.$attrs.strokeLineJoin).assertEqual('LineJoinStyle.Miter'); + done(); + }); + + it('shapeTest_1900', 0, async function (done) { + console.info('shapeTest_1900 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeMiterLimit": "5", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_1900 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_1900 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_1900 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('5.000000'); + done(); + }); + + it('shapeTest_2000', 0, async function (done) { + console.info('shapeTest_2000 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeMiterLimit": "string", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2000 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2000 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2000 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + done(); + }); + + it('shapeTest_2100', 0, async function (done) { + console.info('shapeTest_2100 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeMiterLimit": '-0.11111', + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2100 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2100 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2100 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + done(); + }); + + it('shapeTest_2200', 0, async function (done) { + console.info('shapeTest_1300 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeMiterLimit": 'aaa11111', + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2200 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2200 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2200 component obj is: " + JSON.stringify(obj.$attrs.strokeMiterLimit)); + expect(obj.$attrs.strokeMiterLimit).assertEqual('4.000000'); + done(); + }); + + it('shapeTest_2300', 0, async function (done) { + console.info('shapeTest_2300 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "fillOpacity": "1", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2300 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2300 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2300 component obj is: " + JSON.stringify(obj.$attrs.fillOpacity)); + expect(obj.$attrs.fillOpacity).assertEqual('1.000000'); + done(); + }); + + it('shapeTest_2400', 0, async function (done) { + console.info('shapeTest_2400 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "fillOpacity": "-1", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2400 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2400 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2400 component obj is: " + JSON.stringify(obj.$attrs.fillOpacity)); + expect(obj.$attrs.fillOpacity).assertEqual('0.000000'); + done(); + }); + + it('shapeTest_2500', 0, async function (done) { + console.info('shapeTest_2500 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "fillOpacity": "aaaaaaa", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2500 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2500 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2500 component obj is: " + JSON.stringify(obj.$attrs.fillOpacity)); + expect(obj.$attrs.fillOpacity).assertEqual('nan'); + done(); + }); + + it('shapeTest_2600', 0, async function (done) { + console.info('shapeTest_2600 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "fillOpacity": "aa12345", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2600 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2600 change component color error: " + err.message); + } + await Utils.sleep(2000); + var strJson = getInspectorByKey('shape'); + var obj = JSON.parse(strJson); + console.info("shapeTest_2600 component obj is: " + JSON.stringify(obj.$attrs.fillOpacity)); + expect(obj.$attrs.fillOpacity).assertEqual('nan'); + done(); + }); + + it('shapeTest_2700', 0, async function (done) { + console.info('shapeTest_2700 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeDashArrayOne": "4", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2700 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2700 change component color error: " + err.message); + } + await Utils.sleep(2000); + 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'); + done(); + }); + + it('shapeTest_2800', 0, async function (done) { + console.info('shapeTest_2800 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeDashArrayTwo": "4", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2800 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2800 change component color error: " + err.message); + } + await Utils.sleep(2000); + 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'); + done(); + }); + + it('shapeTest_2900', 0, async function (done) { + console.info('shapeTest_2900 START'); + await Utils.sleep(1000); + try { + var eventData = { + data: { + "strokeDashArrayThree": "4", + } + } + var innerEvent = { + eventId: 901, + priority: events_emitter.EventPriority.LOW + } + console.info("shapeTest_2900 start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("shapeTest_2900 change component color error: " + err.message); + } + await Utils.sleep(2000); + 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'); + done(); + }); + }) +} + diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..cbdda33344be98efbd20d5cb54e6c3fd152183bc --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets @@ -0,0 +1,97 @@ +// @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 spanJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + let options = { + uri: 'pages/span', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get span state success " + JSON.stringify(pages)); + if (!("span" == pages.name)) { + console.info("get span success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push span page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push span page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(2000); + console.info("span after each called"); + }); + + it('testSpan001', 0, async function (done) { + console.info('[testSpan001] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('decoration'); + console.info("[testSpan001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + let decoration = JSON.parse(obj.$attrs.decoration); + expect(decoration.type).assertEqual('TextDecorationType.None'); + expect(decoration.color).assertEqual('#FFFF0000'); + done(); + }); + + it('testSpan002', 0, async function (done) { + console.info('[testSpan002] START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('decoration'); + console.info("[testSpan002] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testSpan002] textCase:" + obj.$attrs.textCase); + expect(obj.$attrs.textCase).assertEqual('TextCase.Normal'); + done(); + }); + + it('testSpan003', 0, async function (done) { + console.info('[testSpan003] START'); + try { + let eventData = { + data: { + "textCaseValue": TextCase.UpperCase + } + } + let indexEvent = { + eventId: 41, + priority: events_emitter.EventPriority.LOW + } + console.info("[testSpan003] start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("[testSpan003] change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJson = getInspectorByKey('decoration'); + console.info("[testSpan003] component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("[testSpan003] textCase:" + obj.$attrs.textCase); + expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase'); + 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 1245d586b62a184f22955341202f8f9c80a36e2c..bfff4fb513ca28872f5229fdf6fd080bf1daec69 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,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. */ -// @ts-nocheck import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; @@ -35,7 +35,7 @@ export default function stepperJsunit() { console.info("push stepper page success " + JSON.stringify(result)); } } catch (err) { - console.error("push stepper page error " + JSON.stringify(result)); + console.error("push stepper page error: " + err); } done() }); 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 4c8fdcbc0cc4f6cf131bbc95b573b6a09957136f..c4898d7448d1a32acaddbb082a705468b1453dea 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,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. */ -// @ts-nocheck import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" import router from '@system.router'; import Utils from './Utils'; @@ -35,7 +35,7 @@ export default function swiperJsunit() { console.info("push swiper page success " + JSON.stringify(result)); } } catch (err) { - console.error("push swiper page error " + JSON.stringify(result)); + console.error("push swiper page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets index dd500e1c7a1d32e73f84723e880013958913f576..87aaae260de7481d5d5c454f99f7f65af2854df8 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets @@ -34,7 +34,7 @@ export default function systemRouterJsunit() { expect(pages.name).assertEqual('systemRouterA'); expect(pages.path).assertEqual('pages/'); } catch (err) { - console.error("[systemRouterTest001] push page error " + JSON.stringify(result)); + console.error("[systemRouterTest001] push page error: " + err); } await Utils.sleep(2000); done(); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets index 94a44ec380b08a4ef0214c6ee3d511724e0d0c99..64e3a8917ac2661dafa099bf228eb9c6895ecd67 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.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,7 +13,6 @@ * 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'; @@ -36,7 +36,7 @@ export default function tabsJsunit() { console.info("push tabs page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push tabs page error:" + JSON.stringify(result)); + console.error("push tabs page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets index 6ae7cd1f7876a18958f9237a56c26614a3502061..4dbad3d6aa3c9047e3871e0e0371720204e8bfc2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets @@ -36,7 +36,7 @@ export default function longPressGestureJsunit() { console.info("push tapGesture page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push tapGesture page error:" + JSON.stringify(result)); + console.error("push tapGesture page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets index 997c19caa56dad5daa113988e4585bfa4d2c1d5e..d59c97c98b62304fedc562d0e84902b97742e491 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets @@ -36,7 +36,7 @@ export default function textJsunit() { console.info("push text page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push text page error:" + JSON.stringify(result)); + console.error("push text page error:" + err); } done() }); @@ -60,6 +60,22 @@ export default function textJsunit() { it('testText_0200', 0, async function (done) { console.info('testText_0200 START'); + let strJson = getInspectorByKey('image'); + console.info("testText_0200 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("testText_0200 component obj is: " + JSON.stringify(obj)); + var res = obj.$attrs.src.indexOf('rawfile/test.png'); + console.info("testText_0200 result is: " + res); + var sres = obj.$attrs.src.slice(res,res + 16); + console.info("testText_0200 slice result is: " + sres); + expect(obj.$type).assertEqual('Image'); + expect(obj.$attrs.src.slice(res,res + 16)).assertEqual('rawfile/test.png'); + console.info('testText_0200 END'); + done(); + }); + + it('testText_0300', 0, async function (done) { + console.info('testText_0300 START'); try { let eventData = { data: { @@ -70,17 +86,17 @@ export default function textJsunit() { eventId: 60, priority: events_emitter.EventPriority.LOW } - console.info("testText_0200 start to publish emit"); + console.info("testText_0300 start to publish emit"); events_emitter.emit(indexEvent, eventData); } catch (err) { - console.log("testText_0200 change component data error: " + err.message); + console.log("testText_0300 change component data error: " + err.message); } await Utils.sleep(4000); let strJsonNew = getInspectorByKey('text'); let objNew = JSON.parse(strJsonNew); - console.info("testText_0200 component objNew is: " + JSON.stringify(objNew)); + console.info("testText_0300 component objNew is: " + JSON.stringify(objNew)); expect(objNew.$attrs.fontSize).assertEqual('10.000000fp'); - console.info('testText_0200 END'); + console.info('testText_0300 END'); done(); }); }) diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..5619c576a50f2a6b695cee7421dc59c4d04ed818 --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.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'; + +export default function ToggleJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("toggle beforeEach start"); + let options = { + uri: 'pages/toggle', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get toggle state pages:" + JSON.stringify(pages)); + if (!("toggle" == pages.name)) { + console.info("get toggle state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push toggle page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push toggle page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("toggle after each called"); + }); + + it('testToggle01', 0, async function (done) { + console.info('[testToggle01] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('toggle'); + let obj = JSON.parse(strJson); + console.info("[testToggle01] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.selectedColor).assertEqual('#330A59F7'); + console.info('[testToggle01] END'); + done(); + }); + + it('testToggle02', 0, async function (done) { + console.info('[testToggle02] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('toggle'); + let obj = JSON.parse(strJson); + console.info("[testToggle02] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('ToggleType.Button'); + console.info('[testToggle02] END'); + done(); + }); + + it('testToggle03', 0, async function (done) { + console.info('[testToggle03] START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('toggle'); + let obj = JSON.parse(strJson); + console.info("[testToggle03] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.isOn).assertEqual('false'); + console.info('[testToggle03] END'); + done(); + }); + + it('testToggle04', 0, async function (done) { + console.info('testToggle04 START'); + try { + let eventData = { + data: { + "isOn": true, + } + } + let indexEvent = { + eventId: 1011, + priority: events_emitter.EventPriority.LOW + } + console.info("testToggle04 start to publish emit"); + events_emitter.emit(indexEvent, eventData); + } catch (err) { + console.log("testToggle04 change component data error: " + err.message); + } + await Utils.sleep(4000); + let strJsonNew = getInspectorByKey('toggle'); + let objNew = JSON.parse(strJsonNew); + console.info("testToggle04 component objNew is: " + JSON.stringify(objNew)); + expect(objNew.$attrs.isOn).assertEqual('true'); + console.info('testToggle04 END'); + done(); + }); + }) +} diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..48596eee66b76c4f5297604d57590f3b86bcd9fd --- /dev/null +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.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 transitionJsunit() { + describe('appInfoTest', function () { + beforeEach(async function (done) { + console.info("text beforeEach start"); + let options = { + uri: 'pages/transition', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get transition state pages:" + JSON.stringify(pages)); + if (!("transition" == pages.name)) { + console.info("get transition state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push transition page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push transition page error:" + JSON.stringify(result)); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("transition after each called"); + }); + + it('transitionTest_0100', 0, async function (done) { + console.info('transitionTest_0100 START'); + let strJson = getInspectorByKey('button'); + console.info("transitionTest_0100 component strJson:" + strJson); + let obj = JSON.parse(strJson); + console.info("transitionTest_0100 component obj is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info('transitionTest_0100 END'); + done(); + }); + + it('transitionTest_0200', 0, async function (done) { + console.info('transitionTest_0200 START'); + let indexEvent = { + eventId: 333, + priority: events_emitter.EventPriority.LOW + } + await Utils.sleep(1000); + let callback = (indexEvent) => { + console.info("transitionTest_0200 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.btn1).assertEqual(false); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("transitionTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("transitionTest_0200 click result is: " + JSON.stringify(sendEventByKey('button',10,""))); + await Utils.sleep(1000); + console.info('transitionTest_0200 END'); + done(); + }); + }) +} \ No newline at end of file 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 a79e1c62fd773c4b38f3fb2e3859e79a1acee686..1d48e8fdbb6cab4d743e6745578dd1b1140de6b8 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 @@ -36,7 +36,7 @@ export default function enableJsunit() { console.info("push zIndex page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push zIndex page error:" + JSON.stringify(result)); + console.error("push zIndex page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets index f64e2aa66f42af30d49fd4ed9a332cf35be05aa0..598b9ec32078a198f759047db2e431c18af44e2b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets @@ -36,7 +36,7 @@ export default function backgroundJsunit() { console.info("push background page success " + JSON.stringify(result)); } } catch (err) { - console.error("push background page error " + JSON.stringify(result)); + console.error("push background page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets index 9102b986e54bb516a2c79625b63750b83ef5f6df..37e214dd96ba88d7e126675741ef2dafb17c368b 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets @@ -36,7 +36,7 @@ export default function borderJsunit() { console.info("push border page success " + JSON.stringify(result)); } } catch (err) { - console.error("push border page error " + JSON.stringify(result)); + console.error("push border page error: " + err); } 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 index 8c9d9f717f9e7cdefbcbeddc7230dcfd70cdf1f6..5b3356583f3d1a1e7fde126b30938e98547057eb 100755 --- 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 @@ -35,7 +35,7 @@ export default function clickEventJsunit() { console.info("push clickEvent page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push clickEvent page error:" + JSON.stringify(result)); + console.error("push clickEvent page error:" + err); } done() }); 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 index bb48bd3fe4752319c43ed2f076a209b8f6efa7e7..930f9afbb2f16e1a8b28467c75d6ee443be6dca8 100755 --- 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 @@ -35,7 +35,7 @@ export default function colorGradientJsunit() { console.info("push colorGradient page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push colorGradient page error:" + JSON.stringify(result)); + console.error("push colorGradient page error:" + err); } 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/general-properties/FlexJsunit.test.ets index 2b60892bfe8b4316533a7696ed2f504a639e11ed..043edbe0573f4c147c30c9562d15f877171dda17 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/general-properties/FlexJsunit.test.ets @@ -35,7 +35,7 @@ export default function flexJsunit() { console.info("push flex page success " + JSON.stringify(result)); } } catch (err) { - console.error("push flex page error " + JSON.stringify(result)); + console.error("push flex page error: " + err); } 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/general-properties/GridSettingsJsunit.test.ets index 0900156b3f407bbc709f64e050a03715d5c0ffa9..3e18a457e8c7ae3f313ecbcb40c297c00ac43cde 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/general-properties/GridSettingsJsunit.test.ets @@ -35,7 +35,7 @@ export default function gridSettingsJsunit() { console.info("push gridSettings page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push gridSettings page error:" + JSON.stringify(result)); + console.error("push gridSettings page error:" + err); } done(); }); 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/general-properties/ImageEffectsJsunit.test.ets index 888c75dac029a04ed16691d3b6f2043b846d79aa..7120fbf1d640cdff920ac175e46b196360f6fdd5 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/general-properties/ImageEffectsJsunit.test.ets @@ -35,7 +35,7 @@ export default function imageEffectsJsunit() { console.info("push imageEffects page success " + JSON.stringify(result)); } } catch (err) { - console.error("push imageEffects page error " + JSON.stringify(err)); + console.error("push imageEffects page error: " + err); } 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/general-properties/LayoutConstraintsJsunit.test.ets index 0e48273f0ad2474016f776e00f3ae4a2fa85d040..8591cce9f463ba8470b02ad41706dc0b1953ff95 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/general-properties/LayoutConstraintsJsunit.test.ets @@ -36,7 +36,7 @@ export default function layoutConstraintsJsunit() { console.info("push layoutConstraints page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push layoutConstraints page error:" + JSON.stringify(result)); + console.error("push layoutConstraints page error:" + err); } done() }); 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 index 06ee85c33acb184ff96e133ef8b440c8a12faa0d..458f18f6908b7281075fd69e69c34f4b252c9fa8 100755 --- 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 @@ -35,7 +35,7 @@ export default function opacitySettingJsunit() { console.info("push opacitySetting page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push opacitySetting page error:" + JSON.stringify(result)); + console.error("push opacitySetting page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets index 6fe6d12bba834b97209530fe01bbbcd51ad08906..14c48b1050e44b972979adabffbbe4300b2600a2 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets @@ -39,7 +39,7 @@ export default function PanGestureJsunit() { console.info("push PanGesture page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push PanGesture page error:" + JSON.stringify(result)); + console.error("push PanGesture page error:" + err); } done() }); 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 index 9b3de1d8f04e7b8727315dab654c8d70208e3a47..f24dbdfbf41fcd8b012669c4b05e4c21e112dad0 100755 --- 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 @@ -35,7 +35,7 @@ export default function positionSettingJsunit() { console.info("push positionSetting page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push positionSetting page error:" + JSON.stringify(result)); + console.error("push positionSetting page error:" + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets index f26462c73fd49f04c51b59ba31ba74c232d67b4b..229dc97ce12a630ab1a2dc75e6444db4fa9b21be 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets @@ -39,7 +39,7 @@ export default function ResponseRegionJsunit() { console.info("push ResponseRegion page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push ResponseRegion page error:" + JSON.stringify(result)); + console.error("push ResponseRegion page error:" + err); } done() }); 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 index 57bfe50e31bcd62a7317de97f24549d3c0b913d3..a444afd26a6eab3c17d69b9b7a4705191b2276b0 100755 --- 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 @@ -35,7 +35,7 @@ export default function shapeClippingJsunit() { console.info("push shapeClipping page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push shapeClipping page error:" + JSON.stringify(result)); + console.error("push shapeClipping page error:" + err); } done() }); 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 index b7d4b99d1ea04277d27a0fd05a025ff74837e6e6..a5f5d3b85bb95f6d4106fa1d9335ee11b209aaa7 100755 --- 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 @@ -35,7 +35,7 @@ export default function sizeSettingJsunit() { console.info("push sizeSetting page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push sizeSetting page error:" + JSON.stringify(result)); + console.error("push sizeSetting page error:" + err); } 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/general-properties/TextStyleJsunit.test.ets index 1b867f2cf9054bba1517f39efbe9304e5fe07632..b29d30a3d65a850f1e39c75ec86666225db612a8 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/general-properties/TextStyleJsunit.test.ets @@ -35,7 +35,7 @@ export default function textStyleJsunit() { console.info("push textStyle page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push textStyle page error:" + JSON.stringify(result)); + console.error("push textStyle page error:" + err); } done(); }); 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 index 333631e0eae31cd91119e9b737dcb573e553caea..da032c948cd7af66d6b82982055f28682cbd5b0d 100755 --- 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 @@ -34,7 +34,7 @@ export default function touchAbleJsunit() { console.info("push touchAble page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push touchAble page error:" + JSON.stringify(result)); + console.error("push touchAble page error:" + err); } done() }); 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/general-properties/TouchJsunit.test.ets similarity index 94% 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/general-properties/TouchJsunit.test.ets index ada5a7a3a9ca6f0ddb9a25c05be832b4afdac2f3..4f7f8da667b406736c168b57a97b6a2d641cf9a5 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/general-properties/TouchJsunit.test.ets @@ -37,7 +37,7 @@ export default function touchJsunit() { console.info("push touch page result: " + JSON.stringify(result)); } }catch(err){ - console.error("push touch page error: " + JSON.stringify(result)); + console.error("push touch page error: " + err); } done() }); diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets index da6a65c6c09c266d1432ed8216283e0723fa8e15..5b798e1b8b4843682c480b465bdf5d7a147f4f03 100755 --- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets +++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets @@ -36,7 +36,7 @@ export default function transFormJsunit() { console.info("push transForm page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push transForm page error:" + JSON.stringify(result)); + console.error("push transForm page error:" + err); } 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/general-properties/VisibilityJsunit.test.ets index dda7d0c49699b6f8d3db9f2a362f63a03fa41a06..98e56d205c4419034f508b99d7712c8b56b10790 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/general-properties/VisibilityJsunit.test.ets @@ -36,7 +36,7 @@ export default function visibilityJsunit() { console.info("push visibility page result:" + JSON.stringify(result)); } } catch (err) { - console.error("push visibility page error:" + JSON.stringify(result)); + console.error("push visibility page error:" + err); } done() });