diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ActionSheetOptions.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ActionSheetOptions.ets index 7d9ee025fb48cce49db91a352f8d00263aee774b..121e423a1bb283b3c326ddcf4076c8829a6d7979 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ActionSheetOptions.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ActionSheetOptions.ets @@ -55,8 +55,9 @@ struct ActionSheetExample { } } ] - }).key('ActionSheet') - }) + }) + }).key('ActionSheet') + }.width('100%') .height('100%') } diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/AlertDialogParam.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/AlertDialogParam.ets index a71ee66f8914ccfd093dc878b0cae449cc10798d..3ba68d6c0045782ad01e77c5d432a200f719e4b0 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/AlertDialogParam.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/AlertDialogParam.ets @@ -40,8 +40,9 @@ struct AlertDialogExample { console.info('Closed callbacks') } } - ).key('AlertDialog') - }) + ) + }).key('AlertDialog') + .backgroundColor(0x317aff) Button('two button dialog') .onClick(() => { @@ -67,7 +68,8 @@ struct AlertDialogExample { } } ) - }).backgroundColor(0x317aff) + }).key('AlertDialog2') + .backgroundColor(0x317aff) }.width('100%').margin({ top: 5 }) } } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/CustomDialogControllerOptions.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/CustomDialogControllerOptions.ets index 49f98e665fb5d4d21be4b26316ad679d951d687b..db3bf697f52979cec9fb11d1f6bedde5b2971370 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/CustomDialogControllerOptions.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/CustomDialogControllerOptions.ets @@ -18,8 +18,7 @@ struct CustomDialogExample { @Link textValue: string @Link inputValue: string - @Link openAnimation: AnimateParam - @Link closeAnimation: AnimateParam + @State widthSize: number = 250 @State heightSize: number = 100 private flag: boolean = true @@ -74,21 +73,21 @@ struct CustomDialogUser { confirm: this.onAccept, textValue: $textValue, inputValue: $inputValue, - openAnimation:{ - duration: 2000, - iterations: 3, - onFinish: () => { - console.info('openAnimation play end') - }, - }, - closeAnimation:{ - duration: 2000, - iterations: 3, - onFinish: () => { - console.info('closeAnimation play end') - }, - } }), + openAnimation:{ + duration: 2000, + iterations: 3, + onFinish: () => { + console.info('openAnimation play end') + } + }, + closeAnimation:{ + duration: 2000, + iterations: 3, + onFinish: () => { + console.info('closeAnimation play end') + } + }, cancel: this.existApp, alignment: DialogAlignment.Top, offset: { dx: 10, dy: 100 }, @@ -123,7 +122,8 @@ struct CustomDialogUser { if (this.dialogController != undefined) { this.dialogController.open() } - }).backgroundColor(0x317aff) + }) + .backgroundColor(0x317aff) }.width('100%').margin({ top: 5 }) } } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DatePickerDialogOptions.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DatePickerDialogOptions.ets index cac073fdcfb6d0e1c4c0c34b0caa8f6bbb1f73f3..f8f2a74e0a952e8bfede7e62d800eb7ad78adc35 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DatePickerDialogOptions.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DatePickerDialogOptions.ets @@ -44,8 +44,9 @@ struct DatePickerDialogOptions0 { onDateChange: (value: Date)=> { console.info("DatePickerDialog: onChange()" + value.toString()) } - }).key('DatePickerDialog') - }) + }) + }).key('DatePickerDialog') + }.width('100%') } } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TextPickerDialogOptions.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TextPickerDialogOptions.ets index ff1f77adc5bfd9b635ba36c31b3d5fcedd059e31..e58c8fae86ca94bfa1f8a7721b88a732e09bd308 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TextPickerDialogOptions.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TextPickerDialogOptions.ets @@ -40,8 +40,8 @@ struct TextPickerDialogExample { onChange: (value: TextPickerResult)=> { console.info("TextPickerDialog: onChange()" + JSON.stringify(value)) } - }).key('TextPickerDialog') - }) + }) + }).key('TextPickerDialog') }.width('100%') } } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TimePickerDialogOptions.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TimePickerDialogOptions.ets index 65000d3f22bdd2a9bd0cdc7a44aee3f19445bd88..15018919f02c23c270c83420fffcf68d3eb2b5c0 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TimePickerDialogOptions.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/TimePickerDialogOptions.ets @@ -39,8 +39,8 @@ struct TimePickerDialogExample { onChange: (value: TimePickerResult)=> { console.info("TimePickerDialog: onChange()" + JSON.stringify(value)) } - }).key('TimePickerDialog') - }) + }) + }).key('TimePickerDialog') }.width('100%') } } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/aboutToRecycleiamge.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/aboutToRecycleiamge.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ef66802c6d3b6b11c068acc6c5eab7697d1b6c1 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/aboutToRecycleiamge.ets @@ -0,0 +1,133 @@ +/** + * Copyright (c) 2022 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. + */ + +class BasicDataSource implements IDataSource { + private listeners: DataChangeListener []= []; + + public totalCount(): number{ + return 0; + } + + public getData(index:number): unknown { + return undefined; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener =>{ + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener =>{ + listener.onDataAdd(index) + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener =>{ + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener =>{ + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number ,to: number): void { + this.listeners.forEach(listener =>{ + listener.onDataMove(from, to); + }) + } +} + +class MyDataSourceImag extends BasicDataSource { + private dataArray: String[] = ['/path/image0','/path/image1','/path/image2','/path/image3']; + + public totalCount(): number { + return this.dataArray.length + } + + public getData(index: number): unknown { + return this.dataArray[index]; + } + + public addData(index: number,data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + + + +@Entry +@Component +struct MyComponentImag{ + private data: MyDataSourceImag = new MyDataSourceImag(); + + build(){ + List({space: 3}){ + LazyForEach(this.data, (item: string) => { + ListItem(){ + ReusableChildComponent({item: item}) + } + }, item => item) + } + .width('100%') + .height('100%') + } +} + +@Reusable +@Component +struct ReusableChildComponent { + @State item: string = '' + + aboutToReuse(params) { + this.item = params.item; + } + + aboutToRecycle(){ + console.log('recycle node'); + } + + build(){ + Row(){ + Image(this.item).width('30%').height(50).key('aboutToRecyclImage') + Text(this.item).fontSize(20).margin({ left:10 }) + }.margin({ left: 10, right: 10}) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ActionSheetJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ActionSheetJsunit.test.ets index 217e01eb76297771f9f5d437a821f6e7b1d2d773..bd5a73b0feb29c39893f3a2f8997132053ea81a7 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ActionSheetJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ActionSheetJsunit.test.ets @@ -46,23 +46,19 @@ export default function ActionSheetJsunit() { it('ActionSheetJsunit_0100', 0, async function (done) { + console.info('ActionSheetJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('ActionSheet')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('ActionSheet'); let obj = JSON.parse(strJson); console.info("[ActionSheetJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[ActionSheetJsunit_0100] subtitle:" + JSON.stringify(obj.$attrs.subtitle)); - console.info("[ActionSheetJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[ActionSheetJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[ActionSheetJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - expect(obj.$attrs.maskRect.x).assertEqual('0.00vp'); - expect(obj.$attrs.maskRect.y).assertEqual('90.00vp'); - expect(obj.$attrs.maskRect.width).assertEqual('80%'); - expect(obj.$attrs.maskRect.height).assertEqual('60%'); - expect(obj.$attrs.subtitle).assertEqual("ActionSheet subtitle"); - + expect(obj.$attrs.label).assertEqual("Click to Show ActionSheet"); console.info('[ActionSheetJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/AlertDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/AlertDialogJsunit.test.ets index f0b9df04fcda23181332321051101caca230f3fa..d197def08fbbd15e7c9532340dbfcff974093b20 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/AlertDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/AlertDialogJsunit.test.ets @@ -46,69 +46,31 @@ export default function AlertDialogJsunit() { it('AlertDialogJsunit_0100', 0, async function (done) { + console.info('AlertDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('AlertDialog')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('AlertDialog'); let obj = JSON.parse(strJson); console.info("[AlertDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[AlertDialogJsunit_0100] subtitle:" + JSON.stringify(obj.$attrs.subtitle)); - console.info("[AlertDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[AlertDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[AlertDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - expect(obj.$attrs.subtitle).assertEqual("subtitle"); - - console.info('[AlertDialogJsunit_0100] END'); - done(); - }); - - it('AlertDialogJsunit_0200', 0, async function (done) { - - console.info('AlertDialogJsunit_0200 START'); - await CommonFunc.sleep(1000); - let driver = await UiDriver.create(); - let btn = await driver.findComponent(BY.key('AlertDialog')); - await btn.click(); - await CommonFunc.sleep(1000); - let strJson = getInspectorByKey('AlertDialog'); - let obj = JSON.parse(strJson); - console.info("[AlertDialogJsunit_0200] component strJson:" + JSON.stringify(obj.$attrs.buttonDirection)); - expect(obj.$attrs.buttonDirection).assertEqual("DialogButtonDirection.AUTO"); - - console.info('[AlertDialogJsunit_0200] END'); - done(); - }); - - it('AlertDialogJsunit_0300', 0, async function (done) { - console.info('AlertDialogJsunit_0300 START'); - await CommonFunc.sleep(1000); - globalThis.value.message.notify({name:'buttonDirection',value:'DialogButtonDirection.HORIZONTAL'}) - let driver = await UiDriver.create(); - let btn = await driver.findComponent(BY.key('AlertDialog')); - await btn.click(); + expect(obj.$attrs.label).assertEqual("one button dialog"); + await driver.pressBack(); + await CommonFunc.sleep(500); + + let button2 = await driver.findComponent(BY.key('AlertDialog2')); + await button2.click(); await CommonFunc.sleep(1000); - let strJson = getInspectorByKey('AlertDialog'); - let obj = JSON.parse(strJson); - console.info("[AlertDialogJsunit_0300] component strJson:" + JSON.stringify(obj.$attrs.buttonDirection)); - expect(obj.$attrs.buttonDirection).assertEqual("DialogButtonDirection.HORIZONTAL "); - console.info('[AlertDialogJsunit_0300] END'); + let strJson2 = getInspectorByKey('AlertDialog2'); + let obj2 = JSON.parse(strJson2); + console.info("[AlertDialogJsunit_0100] component obj2 is: " + JSON.stringify(obj2)); + expect(obj2.$attrs.label).assertEqual("two button dialog"); + console.info('[AlertDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); - it('AlertDialogJsunit_0400', 0, async function (done) { - console.info('AlertDialogJsunit_0400 START'); - await CommonFunc.sleep(1000); - globalThis.value.message.notify({name:'buttonDirection',value:'DialogButtonDirection.VERTICAL'}) - let driver = await UiDriver.create(); - let btn = await driver.findComponent(BY.key('AlertDialog')); - await btn.click(); - await CommonFunc.sleep(1000); - let strJson = getInspectorByKey('AlertDialog'); - let obj = JSON.parse(strJson); - console.info("[AlertDialogJsunit_0400] component strJson:" + JSON.stringify(obj.$attrs.buttonDirection)); - expect(obj.$attrs.buttonDirection).assertEqual("DialogButtonDirection.VERTICAL"); - console.info('[AlertDialogJsunit_0400] END'); - done(); - }); }) } diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/CustomDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/CustomDialogJsunit.test.ets index be8be700a116168fd8c3479c1b1e9dea1fd567f9..804310d2b6f737801f58b9e0920853b16490ce78 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/CustomDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/CustomDialogJsunit.test.ets @@ -47,18 +47,16 @@ export default function CustomDialogJsunit() { it('CustomDialogJsunit_0100', 0, async function (done) { console.info('CustomDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('CustomDialog')); + await button.click(); await CommonFunc.sleep(1000); - let strJson = getInspectorByKey('CustomDialog'); let obj = JSON.parse(strJson); console.info("[CustomDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[CustomDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[CustomDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[CustomDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - console.info("[CustomDialogJsunit_0100] cornerRadius:" + JSON.stringify(obj.$attrs.cornerRadius)); - expect(obj.$attrs.cornerRadius).assertEqual("5vp"); - + expect(obj.$attrs.label).assertEqual("click me"); console.info('[CustomDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/DatePickerDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/DatePickerDialogJsunit.test.ets index 8b66c611c6225ee6a01e8de82d2705d851ae7884..037f0e1de506b00f30f81a7c2d411a18bcb34580 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/DatePickerDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/DatePickerDialogJsunit.test.ets @@ -43,24 +43,20 @@ export default function DatePickerDialogJsunit() { done() }); - it('DatePickerDialogJsunit_0100', 0, async function (done) { console.info('DatePickerDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('DatePickerDialog')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('DatePickerDialog'); let obj = JSON.parse(strJson); console.info("[DatePickerDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[DatePickerDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[DatePickerDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[DatePickerDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - console.info("[DatePickerDialogJsunit_0100] selected:" + JSON.stringify(obj.$attrs.selected)); - console.info("[DatePickerDialogJsunit_0100] showTime:" + JSON.stringify(obj.$attrs.showTime)); - expect(obj.$attrs.selected).assertEqual("2023-7-24"); - expect(obj.$attrs.showTime).assertEqual(true); - + expect(obj.$attrs.label).assertEqual("DatePickerDialog"); console.info('[DatePickerDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets index b8c86d9da952fa15aa4adc8329afe330eda4eefe..2914f71b47f69727d6473e99eb05edffa471da39 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets @@ -71,6 +71,7 @@ import TimePickerDialogJsunit from './TimePickerDialogJsunit.test.ets'; import OverlayJsunit from './OverlayJsunit.test.ets'; import PanelJsunit from './PanelJsunit.test.ets'; import GridCallbackJsunit from './GridCallbackJsunit.test.ets'; +import aboutToRecycleiamge from './aboutToRecycleiamgeJS.test.ets' export default function testsuite() { DialogJsunit(); @@ -131,4 +132,5 @@ export default function testsuite() { OverlayJsunit(); PanelJsunit(); GridCallbackJsunit(); + aboutToRecycleiamge(); } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/OverlayJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/OverlayJsunit.test.ets index 7384de26aaf624ae5c558d0e5690925efa51dac3..3b50e0a0c9a50da9f226f41aba2dbf8a471789e0 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/OverlayJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/OverlayJsunit.test.ets @@ -260,7 +260,7 @@ export default function overLayJsunit() { } } var innerEvent = { - eventId: 143, + eventId: 1110, priority: events_emitter.EventPriority.LOW } console.info("[overLayJsunit_0900] start to publish emit"); @@ -272,7 +272,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_0900] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.Top"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_0900 END'); done(); }); @@ -299,7 +299,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_1000] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopEnd"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_1000 END'); done(); }); @@ -326,7 +326,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_1100] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.Start"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_1100 END'); done(); }); @@ -353,7 +353,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_1200] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.End"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_1200 END'); done(); }); @@ -380,7 +380,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_1300] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.BottomEnd"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_1300 END'); done(); }); @@ -407,7 +407,7 @@ export default function overLayJsunit() { let strJson = getInspectorByKey('overlay'); let obj = JSON.parse(strJson); console.info("[overLayJsunit_1400] obj is: " + JSON.stringify(obj.$attrs.overlay)); - expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.BottomStart"); + expect(obj.$attrs.overlay.options.align).assertEqual("Alignment.TopStart"); console.info('overLayJsunit_1400 END'); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/PanelJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/PanelJsunit.test.ets index eb40c106b06990ca2b8d4c8d8df3b2a827d7f029..02fe4584de1b201831b27771adc0f62bdcd56df7 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/PanelJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/PanelJsunit.test.ets @@ -52,7 +52,7 @@ export default function PanelJsunit() { let strJson = getInspectorByKey('PanelText'); let obj = JSON.parse(strJson); console.info("[PanelJsunit_0100] obj is: " + JSON.stringify(obj.$attrs.customHeight)); - expect(obj.$attrs.customHeight).assertEqual("PanelHeight.WRAP_CONTENT"); + expect(obj.$attrs.customHeight).assertEqual("0.00px"); console.info('[PanelJsunit_0100] END'); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ShowDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ShowDialogJsunit.test.ets index c261cf69218e267130f8d7018de9243239273f93..3b1cca74f2507f7c8cbb558c1ac9d8ce88fd00e0 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ShowDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ShowDialogJsunit.test.ets @@ -46,19 +46,19 @@ export default function ShowDialogJsunit() { it('ShowDialogJsunit_0100', 0, async function (done) { + console.info('ShowDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('ShowDialog')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('ShowDialog'); let obj = JSON.parse(strJson); console.info("[ShowDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[ShowDialogJsunit_0100] title:" + JSON.stringify(obj.$attrs.title)); - console.info("[ShowDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[ShowDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[ShowDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - expect(obj.$attrs.title).assertEqual("Title Info"); - + expect(obj.$attrs.label).assertEqual("PromptActionDialog"); console.info('[ShowDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerDialogJsunit.test.ets index 9a8bbe10a9602a66fea7d47d7b1b4a04649c04be..e6d1846ddfc347b1128b9b42b0a5d785e360bcf6 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerDialogJsunit.test.ets @@ -46,18 +46,19 @@ export default function TextPickerDialogJsunit() { it('TextPickerDialogJsunit_0100', 0, async function (done) { + console.info('TextPickerDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('TextPickerDialog')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('TextPickerDialog'); let obj = JSON.parse(strJson); console.info("[TextPickerDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[TextPickerDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[TextPickerDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[TextPickerDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - expect(obj.$attrs.alignment).assertEqual("DialogAlignment.TopStart"); - + expect(obj.$attrs.label).assertEqual("TextPickerDialog"); console.info('[TextPickerDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerDialogJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerDialogJsunit.test.ets index 634aec9aba878c0e80cc3bc818092fc43294a362..dbfb3d5f0ae9cd4a72a8ff30eac45dfea1e6188c 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerDialogJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerDialogJsunit.test.ets @@ -45,20 +45,19 @@ export default function TimePickerDialogJsunit() { it('TimePickerDialogJsunit_0100', 0, async function (done) { - + console.info('TimePickerDialogJsunit_0100 START'); + let driver = await UiDriver.create() + let button = await driver.findComponent(BY.key('TimePickerDialog')); + await button.click(); await CommonFunc.sleep(1000); let strJson = getInspectorByKey('TimePickerDialog'); let obj = JSON.parse(strJson); console.info("[TimePickerDialogJsunit_0100] component obj is: " + JSON.stringify(obj)); - console.info("[TimePickerDialogJsunit_0100] selected:" + JSON.stringify(obj.$attrs.selected)); - console.info("[TimePickerDialogJsunit_0100] alignment:" + JSON.stringify(obj.$attrs.alignment)); - console.info("[TimePickerDialogJsunit_0100] offset:" + JSON.stringify(obj.$attrs.offset)); - console.info("[TimePickerDialogJsunit_0100] maskRect:" + JSON.stringify(obj.$attrs.maskRect)); - expect(obj.$attrs.selected).assertEqual("2020-12-25T08:30:00"); - + expect(obj.$attrs.label).assertEqual("TimePickerDialog"); console.info('[TimePickerDialogJsunit_0100] END'); + await driver.pressBack(); done(); }); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/aboutToRecycleiamgeJS.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/aboutToRecycleiamgeJS.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fcef48a8a34e49829a37536146f10ebb31da4da --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/aboutToRecycleiamgeJS.test.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2022 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 "@ohos/hypium" +import router from '@system.router'; +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest'; +import CommonFunc from '../MainAbility/utils/Common'; +import {MessageManager,Callback} from '../MainAbility/utils/MessageManager'; + +export default function aboutToRecycleiamge() { + describe('aboutToRecycleiamge', function () { + beforeEach(async function (done) { + console.info("aboutToRecycleiamge beforeEach start"); + let options = { + uri: 'MainAbility/pages/aboutToRecycleiamge', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get aboutToRecycleiamge state pages: " + JSON.stringify(pages)); + if (!("aboutToRecycleiamge" == pages.name)) { + console.info("get aboutToRecycleiamge state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push aboutToRecycleiamge page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push aboutToRecycleiamge page error:" + err); + } + done() + }); + + afterEach(async function () { + await CommonFunc.sleep(1000); + console.info("aboutToRecycleiamge after each called"); + }); + + it('aboutToRecycleiamge_0100', 0, async function (done) { + console.info('[aboutToRecycleiamge_0100] START'); + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('aboutToRecyclImage'); + let obj = JSON.parse(strJson); + console.info("[aboutToRecycleiamge_0100] obj is: " + JSON.stringify(obj.$attrs.height)); + expect(obj.$attrs.height).assertEqual("50.00vp"); + console.info('[aboutToRecycleiamge_0100] END'); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json index 7ecbe8046fac12355c99f03c4492c7e7dfa501fc..4336b4403d8ec4f393ef1e9d17dfa599e146efe7 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json @@ -102,7 +102,8 @@ "MainAbility/pages/TimePickerDialogOptions", "MainAbility/pages/overlay", "MainAbility/pages/Panel", - "MainAbility/pages/GridCallbackPage" + "MainAbility/pages/GridCallbackPage", + "MainAbility/pages/aboutToRecycleiamge" ] } \ No newline at end of file