diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/big_icon.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/big_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..7a32b59293c29076b7ff37af37dc09318aa26462 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/big_icon.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/blue_icon.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/blue_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..e4f90ec6327918ffede212ff7a4b3868d2d0addf Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/blue_icon.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/caiyuan.jpg b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/caiyuan.jpg new file mode 100755 index 0000000000000000000000000000000000000000..a5fe3a15a2ebe767e811aad2917f06860f88ee26 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/caiyuan.jpg differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/closeeye.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/closeeye.png new file mode 100755 index 0000000000000000000000000000000000000000..c59a90fb37dd9cea9724d9e1b953767416981efc Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/closeeye.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/color.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/color.json new file mode 100755 index 0000000000000000000000000000000000000000..927411774f6cf14ac8231d6bf342c1020d530dc5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "Pink", + "value": "#FFC0CB" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img.png new file mode 100755 index 0000000000000000000000000000000000000000..f0db31a954039edac72e84a149dc09c608d3b6f4 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img2.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img2.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/img2.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXDrawTest/DFXDraw.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXDrawTest/DFXDraw.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1d437fe744e564cc5a98dcdbae1957f43b9b3d0b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXDrawTest/DFXDraw.test.ets @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function DFXDraw() { + + describe('DFXDraw', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_DRAW_0010_1 + * @tc.name SUB_ACE_DFX_DRAW_0010_1 + * @tc.desc UIObserver + */ + it('SUB_ACE_DFX_DRAW_0010_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_1 start.`); + Settings.createWindow("testability/pages/DFXDraw/DFXDraw0010"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_DRAW_0010_2 + * @tc.name SUB_ACE_DFX_DRAW_0010_2 + * @tc.desc UIObserver + */ + it('SUB_ACE_DFX_DRAW_0010_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_2 start.`); + Settings.createWindow("testability/pages/DFXDraw/DFXDraw0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('DFXDraw0010_btn1')); + await Utils.sleep(500); + await btn1.click(); + await Utils.sleep(500); + await btn1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_DRAW_0010_3 + * @tc.name SUB_ACE_DFX_DRAW_0010_3 + * @tc.desc UIObserver + */ + it('SUB_ACE_DFX_DRAW_0010_3', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_3 start.`); + Settings.createWindow("testability/pages/DFXDraw/DFXDraw0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('DFXDraw0010_btn1')); + let btn2 = await driver.findComponent(ON.id('DFXDraw0010_btn2')); + await Utils.sleep(1000); + await btn2.click(); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_3 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_DRAW_0010_4 + * @tc.name SUB_ACE_DFX_DRAW_0010_4 + * @tc.desc UIObserver + */ + it('SUB_ACE_DFX_DRAW_0010_4', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_4 start.`); + Settings.createWindow("testability/pages/DFXDraw/DFXDraw0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('DFXDraw0010_btn1')); + let btn3 = await driver.findComponent(ON.id('DFXDraw0010_btn3')); + await Utils.sleep(1000); + await btn3.click(); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_DRAW_0010_4 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXScrollEventObserverTest/DFXScrollEventObserver.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXScrollEventObserverTest/DFXScrollEventObserver.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..b0b8570b3d3fa00c2bd8792246220dc63a44c2e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/DFXScrollEventObserverTest/DFXScrollEventObserver.test.ets @@ -0,0 +1,711 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function DFXScrollEventObserver() { + + describe('DFXScrollEventObserver', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0010 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0010 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0010', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0010 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + await Utils.sleep(500); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0010 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0020 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0020 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0020 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0020"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('scroll_btn')); + await Utils.sleep(500); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0020 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0030_1 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0030_1 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0030_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0030_1 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0030_btn2')); + await Utils.sleep(1000); + let grid = await driver.findComponent(ON.type('Grid')); + await Utils.sleep(500); + let point = await grid.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0030_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0030_2 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0030_2 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0030_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0030_2 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let obserBtn = await driver.findComponent(ON.id('ScrollEventObserver0030_btn1')); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0030_btn2')); + await Utils.sleep(1000); + await obserBtn.click(); + await Utils.sleep(1000); + let grid = await driver.findComponent(ON.type('Grid')); + await Utils.sleep(500); + let point = await grid.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0030_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0040_1 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0040_1 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0040_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0040_1 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let list = await driver.findComponent(ON.type('List')); + await Utils.sleep(500); + let point = await list.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0040_btn2')); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0040_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0040_2 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0040_2 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0040_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0040_2 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let obserBtn = await driver.findComponent(ON.id('ScrollEventObserver0040_btn1')); + await Utils.sleep(1000); + await obserBtn.click(); + await Utils.sleep(1000); + let list = await driver.findComponent(ON.type('List')); + await Utils.sleep(500); + let point = await list.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0040_btn2')); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0040_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0050_1 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0050_1 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0050_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0050_1 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0050_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0050_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0050_2 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0050_2 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0050_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0050_2 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let obserBtn = await driver.findComponent(ON.id('ScrollEventObserver0050_btn1')); + await Utils.sleep(1000); + await obserBtn.click(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0050_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0050_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0060_1 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0060_1 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0060_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0060_1 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let waterFlow = await driver.findComponent(ON.type('WaterFlow')); + await Utils.sleep(500); + let point = await waterFlow.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0060_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0060_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0060_2 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0060_2 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0060_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0060_2 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let obserBtn = await driver.findComponent(ON.id('ScrollEventObserver0060_btn1')); + await Utils.sleep(1000); + await obserBtn.click(); + await Utils.sleep(1000); + let waterFlow = await driver.findComponent(ON.type('WaterFlow')); + await Utils.sleep(500); + let point = await waterFlow.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0060_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0060_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0070 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0070 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0070', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0070 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let list = await driver.findComponent(ON.type('List')); + await Utils.sleep(500); + let point = await list.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0040_btn2')); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0070 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0080 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0080 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0080', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0080 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0050_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0080 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0090 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0090 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0090 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0090"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let list = await driver.findComponent(ON.type('List')); + await Utils.sleep(500); + let point = await list.getBoundsCenter(); + await Utils.sleep(1000); + await driver.drag(point.x, point.y, point.x * 2, point.y); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0090_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0090 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0100 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0100 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0100', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0100 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0100"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let list = await driver.findComponent(ON.type('List')); + await Utils.sleep(500); + let point = await list.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0100_btn2')); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0100 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0110 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0110 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0110', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0110 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0110"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let obserBtn = await driver.findComponent(ON.id('ScrollEventObserver0110_btn1')); + await Utils.sleep(1000); + await obserBtn.click(); + await Utils.sleep(1000); + let waterFlow = await driver.findComponent(ON.type('WaterFlow')); + await Utils.sleep(500); + let point = await waterFlow.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0110_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0110 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0120 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0120 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0120', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0120 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let grid = await driver.findComponent(ON.type('Grid')); + await Utils.sleep(500); + let point = await grid.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.id('ScrollEventObserver0030_btn2')); + await Utils.sleep(1000); + await scroll.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0120 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0130 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0130 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0130', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0130 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.mouseScroll(point, true, 2); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0050_btn2')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await driver.click(300, 600); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0130 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0140 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0140 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0140', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0140 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let pageBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn2')); + await Utils.sleep(1000); + await pageBtn.click(); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0140 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0150 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0150 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0150', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0150 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + await Utils.sleep(500); + let point = await scroll.getBoundsCenter(); + await Utils.sleep(1000); + await driver.swipe(point.x, point.y * 2, point.x, point.y); + await Utils.sleep(1000); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + await Utils.sleep(500); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0150 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0160 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0160 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0160', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0160 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + let scrollBtn2 = await driver.findComponent(ON.id('ScrollEventObserver0010_btn3')); + await Utils.sleep(1000); + await scrollBtn2.click(); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0160 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0170 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0170 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0170', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0170 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + let scrollBtn2 = await driver.findComponent(ON.id('ScrollEventObserver0010_btn4')); + await Utils.sleep(1000); + await scrollBtn2.click(); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0170 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0180_1 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0180_1 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0180_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0180_1 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + let scrollBtn2 = await driver.findComponent(ON.id('ScrollEventObserver0010_btn5')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(1000); + await scrollBtn2.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0180_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0180_2 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0180_2 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0180_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0180_2 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0180_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_DFX_ScrollEventObserver_0190 + * @tc.name SUB_ACE_DFX_ScrollEventObserver_0190 + * @tc.desc Scroll + */ + it('SUB_ACE_DFX_ScrollEventObserver_0190', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0190 start.`); + Settings.createWindow("testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let scroll = await driver.findComponent(ON.type('Scroll')); + let scrollBtn = await driver.findComponent(ON.id('ScrollEventObserver0010_btn1')); + let scrollBtn2 = await driver.findComponent(ON.id('ScrollEventObserver0010_btn6')); + await Utils.sleep(1000); + await scrollBtn2.click(); + await Utils.sleep(1000); + await scrollBtn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_DFX_ScrollEventObserver_0190 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets index 0860e1238b7d5125d3247205585c174e61e3e827..a02e98b61244c536b9540e33b73334b9a3d4352c 100644 --- a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets @@ -149,6 +149,167 @@ import UIComponentPopupBoxToastStyleInterface001 from './UIComponentPopupBoxToastStyleInterfaceTest/UIComponentPopupBoxToastStyleInterface001.test'; import UIComponentPopupBoxFullDialogInterface001 from './UIComponentPopupBoxFullDialogInterfaceTest/UIComponentPopupBoxFullDialogInterface001.test'; + +import UIAttributeFontInterfaceButton001 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton001.test'; +import UIAttributeFontInterfaceButton002 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton002.test'; +import UIAttributeFontInterfaceButton003 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton003.test'; +import UIAttributeFontInterfaceCanvas001 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas001.test'; +import UIAttributeFontInterfaceCanvas002 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas002.test'; +import UIAttributeFontInterfaceCanvas003 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas003.test'; +import UIAttributeFontInterfaceCanvas004 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas004.test'; +import UIAttributeFontInterfaceCanvas005 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas005.test'; +import UIAttributeFontInterfaceCanvas006 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas006.test'; +import UIAttributeFontInterfaceCircle001 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle001.test'; +import UIAttributeFontInterfaceCircle002 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle002.test'; +import UIAttributeFontInterfaceCircle003 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle003.test'; +import UIAttributeFontInterfaceCircle004 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle004.test'; +import UIAttributeFontInterfaceCircle005 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle005.test'; +import UIAttributeFontInterfaceCustomDialog001 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog001.test'; +import UIAttributeFontInterfaceCustomDialog002 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog002.test'; +import UIAttributeFontInterfaceCustomDialog003 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog003.test'; +import UIAttributeFontInterfaceCustomDialog004 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog004.test'; +import UIAttributeFontInterfaceCustomDialog005 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog005.test'; +import UIAttributeFontInterfaceCustomDialog006 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog006.test'; +import UIAttributeFontInterfaceCustomDialog007 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog007.test'; +import UIAttributeFontInterfaceImage001 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage001.test'; +import UIAttributeFontInterfaceImage002 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage002.test'; +import UIAttributeFontInterfaceImage003 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage003.test'; +import UIAttributeFontInterfaceImage004 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage004.test'; +import UIAttributeFontInterfaceImage005 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage005.test'; +import UIAttributeFontInterfaceImage006 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage006.test'; +import UIAttributeFontInterfaceMenu001 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu001.test'; +import UIAttributeFontInterfaceMenu002 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu002.test'; +import UIAttributeFontInterfaceMenu003 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu003.test'; +import UIAttributeFontInterfaceMenu004 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu004.test'; +import UIAttributeFontInterfaceMenu005 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu005.test'; +import UIAttributeFontInterfaceMenu006 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu006.test'; +import UIAttributeFontInterfaceMenu007 from './UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu007.test'; +import UIAttributeFontInterfacePopup001 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup001.test'; +import UIAttributeFontInterfacePopup002 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup002.test'; +import UIAttributeFontInterfacePopup003 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup003.test'; +import UIAttributeFontInterfacePopup004 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup004.test'; +import UIAttributeFontInterfacePopup005 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup005.test'; +import UIAttributeFontInterfacePopup006 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup006.test'; +import UIAttributeFontInterfacePopup007 + from './UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup007.test'; +import UIAttributeFontInterfaceSlider001 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider001.test'; +import UIAttributeFontInterfaceSlider002 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider002.test'; +import UIAttributeFontInterfaceSlider003 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider003.test'; +import UIAttributeFontInterfaceSlider004 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider004.test'; +import UIAttributeFontInterfaceSlider005 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider005.test'; +import UIAttributeFontInterfaceSlider006 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider006.test'; +import UIAttributeFontInterfaceSlider007 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider007.test'; +import UIAttributeFontInterfaceText001 from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText001.test'; +import UIAttributeFontInterfaceText002 from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText002.test'; +import UIAttributeFontInterfaceText003 from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText003.test'; +import UIAttributeFontInterfaceText004 from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText004.test'; +import UIAttributeFontInterfaceText005 from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText005.test'; +import UIAttributeFontInterfaceVideo001 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo001.test'; +import UIAttributeFontInterfaceVideo002 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo002.test'; +import UIAttributeFontInterfaceVideo003 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo003.test'; +import UIAttributeFontInterfaceVideo004 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo004.test'; +import UIAttributeFontInterfaceVideo005 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo005.test'; +import UIAttributeFontInterfaceVideo006 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo006.test'; +import UIAttributeFontInterfaceVideo007 + from './UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo007.test'; +import UIComponentPopupBoxActionsheetInterfaceReplacement + from './UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement.test'; +import UIComponentPopupboxMenuStyleEnhancementReplacement + from './UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement.test'; +import UIComponentUISupportColorReplacement + from './UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement.test'; +import UIWebDrawPipeline from './UIWebDrawPipelineTest/UIWebDrawPipeline.test'; +import UIRenderComComponent from './UIRenderComComponentTest/UIRenderComComponent.test'; +import UIComponentPopupBoxCalendarPickerFeatureReplacement + from './UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement.test'; +import UIComponentPopupBoxAlertDialogInterfaceReplacement + from './UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement.test'; + +import SubAceStatusManagerDataDotting from './SubAceStatusManagerDataDottingTest/SubAceStatusManagerDataDotting.test'; +import UIAttributeFontInterfaceCircle0210 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0210.test'; +import UIAttributeFontInterfaceImage0220 + from './UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage0220.test'; +import UIAttributeFontInterfaceSlider0180 + from './UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider0180.test'; +import UIAttributeFontInterfaceCustomDialog0330 + from './UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog0330.test'; +import UIAttributeFontInterfaceCircle0270 + from './UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0270.test'; +import UIAttributeFontInterfaceCanvas007 + from './UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas007.test'; +import UIAttributeFontInterfaceButton004 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton004.test'; +import UIAttributeFontInterfaceButton0190 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0190.test'; +import UIAttributeFontInterfaceButton0310 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0310.test'; +import UIAttributeFontInterfaceButton0320 + from './UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0320.test'; +import UIAttributeFontInterfaceText0140 + from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0140.test'; +import UIAttributeFontInterfaceText0200 + from './UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0200.test'; +import UIAttributeFontInterfaceDarkMode001 + from './UIAttributeFontInterfaceDarkModeTest/UIAttributeFontInterfaceDarkMode001.test'; +import UIPopuBoxSupportCustomIzationStyleReplacement001 + from './UIPopuBoxSupportCustomIzationStyleReplacementTest/UIPopuBoxSupportCustomIzationStyleReplacement001.test'; +import UIPopuBoxAlertDialogCalendarPickerReplacement001 + from './UIPopuBoxAlertDialogCalendarPickerReplacementTest/UIPopuBoxAlertDialogCalendarPickerReplacement001.test'; +import UIComponmentCanvasModifierReplacement001 + from './UIComponmentCanvasModifierReplacementTest/UIComponmentCanvasModifierReplacement001.test'; +import DFXScrollEventObserver from './DFXScrollEventObserverTest/DFXScrollEventObserver.test'; +import DFXDraw from './DFXDrawTest/DFXDraw.test'; +import UIAnimationCustomTransitionInterface + from './UIAnimationCustomTransitionInterfaceTest/UIAnimationCustomTransitionInterface.test'; +import UIAnimationParticleOption from './UIAnimationParticleOptionTest/UIAnimationParticleOption.test'; +import UIAnimationParticleSpin from './UIAnimationParticleSpinTest/UIAnimationParticleSpin.test'; export default function testsuite() { ComponentTextRicheditorFontfeatures(); @@ -239,6 +400,98 @@ export default function testsuite() { UIComponentPopupBoxAttribute(); UIComponentPopupBoxPromptToastSequence(); UIComponentPopupBoxSpecificationsPopup(); + + UIAttributeFontInterfaceButton001(); + UIAttributeFontInterfaceButton002(); + UIAttributeFontInterfaceButton003(); + UIAttributeFontInterfaceCanvas001(); + UIAttributeFontInterfaceCanvas002(); + UIAttributeFontInterfaceCanvas003(); + UIAttributeFontInterfaceCanvas004(); + UIAttributeFontInterfaceCanvas005(); + UIAttributeFontInterfaceCanvas006(); + UIAttributeFontInterfaceCircle001(); + UIAttributeFontInterfaceCircle002(); + UIAttributeFontInterfaceCircle003(); + UIAttributeFontInterfaceCircle004(); + UIAttributeFontInterfaceCircle005(); + UIAttributeFontInterfaceCustomDialog001(); + UIAttributeFontInterfaceCustomDialog002(); + UIAttributeFontInterfaceCustomDialog003(); + UIAttributeFontInterfaceCustomDialog004(); + UIAttributeFontInterfaceCustomDialog005(); + UIAttributeFontInterfaceCustomDialog006(); + UIAttributeFontInterfaceCustomDialog007(); + UIAttributeFontInterfaceImage001(); + UIAttributeFontInterfaceImage002(); + UIAttributeFontInterfaceImage003(); + UIAttributeFontInterfaceImage004(); + UIAttributeFontInterfaceImage005(); + UIAttributeFontInterfaceImage006(); + UIAttributeFontInterfaceMenu001(); + UIAttributeFontInterfaceMenu002(); + UIAttributeFontInterfaceMenu003(); + UIAttributeFontInterfaceMenu004(); + UIAttributeFontInterfaceMenu005(); + UIAttributeFontInterfaceMenu006(); + UIAttributeFontInterfaceMenu007(); + UIAttributeFontInterfacePopup001(); + UIAttributeFontInterfacePopup002(); + UIAttributeFontInterfacePopup003(); + UIAttributeFontInterfacePopup004(); + UIAttributeFontInterfacePopup005(); + UIAttributeFontInterfacePopup006(); + UIAttributeFontInterfacePopup007(); + UIAttributeFontInterfaceSlider001(); + UIAttributeFontInterfaceSlider002(); + UIAttributeFontInterfaceSlider003(); + UIAttributeFontInterfaceSlider004(); + UIAttributeFontInterfaceSlider005(); + UIAttributeFontInterfaceSlider006(); + UIAttributeFontInterfaceSlider007(); + UIAttributeFontInterfaceText001(); + UIAttributeFontInterfaceText002(); + UIAttributeFontInterfaceText003(); + UIAttributeFontInterfaceText004(); + UIAttributeFontInterfaceText005(); + UIAttributeFontInterfaceVideo001(); + UIAttributeFontInterfaceVideo002(); + UIAttributeFontInterfaceVideo003(); + UIAttributeFontInterfaceVideo004(); + UIAttributeFontInterfaceVideo005(); + UIAttributeFontInterfaceVideo006(); + UIAttributeFontInterfaceVideo007(); + SubAceStatusManagerDataDotting(); + + UIComponentPopupboxMenuStyleEnhancementReplacement(); + UIComponentUISupportColorReplacement(); + UIComponentPopupBoxActionsheetInterfaceReplacement(); + UIWebDrawPipeline(); + UIRenderComComponent(); + UIComponentPopupBoxCalendarPickerFeatureReplacement(); + UIComponentPopupBoxAlertDialogInterfaceReplacement(); + + UIAttributeFontInterfaceCircle0270(); + UIAttributeFontInterfaceButton004(); + UIAttributeFontInterfaceButton0190(); + UIAttributeFontInterfaceButton0310(); + UIAttributeFontInterfaceButton0320(); + UIAttributeFontInterfaceText0140(); + UIAttributeFontInterfaceText0200(); + UIAttributeFontInterfaceCanvas007(); + UIAttributeFontInterfaceCircle0210(); + UIAttributeFontInterfaceImage0220(); + UIAttributeFontInterfaceSlider0180(); + UIAttributeFontInterfaceCustomDialog0330(); + UIAttributeFontInterfaceDarkMode001(); + UIPopuBoxSupportCustomIzationStyleReplacement001(); + UIPopuBoxAlertDialogCalendarPickerReplacement001(); + UIComponmentCanvasModifierReplacement001(); + DFXScrollEventObserver(); + DFXDraw(); + UIAnimationCustomTransitionInterface(); + UIAnimationParticleOption(); + UIAnimationParticleSpin(); } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/SubAceStatusManagerDataDottingTest/SubAceStatusManagerDataDotting.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/SubAceStatusManagerDataDottingTest/SubAceStatusManagerDataDotting.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6133d016417b952794cc9c41b9419b7708202154 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/SubAceStatusManagerDataDottingTest/SubAceStatusManagerDataDotting.test.ets @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0160: + * 验证CheckBoxGroup组件动态切换浅色模式-深色模式正常切换 + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function SubAceStatusManagerDataDotting0010() { + + describe('SubAceStatusManagerDataDotting0010', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + + /* + * @tc.number SUB_ACE_STATUSMANAGER_DATADOTTING_0010 + * @tc.name SUB_ACE_STATUSMANAGER_DATADOTTING_0010 + * @tc.desc List组件内嵌套多个可滑动图片 + */ + it('SUB_ACE_STATUSMANAGER_DATADOTTING_0010', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_STATUSMANAGER_DATADOTTING_0010 start.`); + Settings.createWindow("testability/pages/SubAceStatusManagerDataDotting/SubAceStatusManagerDataDotting0010"); + let driver: Driver = Driver.create() + await Utils.sleep(500); + let list: Component = await driver.findComponent(ON.id('list')) + await Utils.sleep(500); + let bounds = await list.getBounds() + await Utils.sleep(500); + await driver.swipe(bounds.right / 2, bounds.bottom * 0.75, bounds.right / 2, bounds.bottom * 0, 2000) + await Utils.sleep(1500) + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_STATUSMANAGER_DATADOTTING_0010 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationCustomTransitionInterfaceTest/UIAnimationCustomTransitionInterface.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationCustomTransitionInterfaceTest/UIAnimationCustomTransitionInterface.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..20ed5c83e3a4f9b486411554be52d2ffa02db031 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationCustomTransitionInterfaceTest/UIAnimationCustomTransitionInterface.test.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAnimationCustomTransitionInterface() { + + describe('UIAnimationCustomTransitionInterface', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_CUSTOMANIMATION_INTERFACE_0050 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_CUSTOMANIMATION_INTERFACE_0050 + * @tc.desc UIObserver + */ + it('SUB_ACE_UI_MOTION_ANIMATION_CUSTOMANIMATION_INTERFACE_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_CUSTOMANIMATION_INTERFACE_0050 start.`); + Settings.createWindow("testability/pages/UIAnimationCustomTransitionInterface/UIAnimationCustomTransitionInterface0050"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_CUSTOMANIMATION_INTERFACE_0050 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleOptionTest/UIAnimationParticleOption.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleOptionTest/UIAnimationParticleOption.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..03aff3b08cf436b86e50b403dbf41317ad63c206 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleOptionTest/UIAnimationParticleOption.test.ets @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAnimationParticleOption() { + + describe('UIAnimationParticleOption', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0020 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0020 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0020 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0020"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0020 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0040 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0040 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0040 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0040"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0040 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0060 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0060 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0060', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0060 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0060"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0060 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0090 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0090 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0090 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0090"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0090 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0110 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0110 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0110', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0110 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0110"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0110 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0130 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0130 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0130', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0130 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0130"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0130 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0170 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0170 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0170', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0170 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0170"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0170 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0180 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0180 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0180', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0180 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0180"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0180 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0190 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0190 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0190', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0190 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0190"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0190 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0200 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0200 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0200', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0200 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0200"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0200 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0230 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0230 + * @tc.desc + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0230 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0230"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_0230 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleSpinTest/UIAnimationParticleSpin.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleSpinTest/UIAnimationParticleSpin.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f02502ca629b836a7a5148653b634d2ed3731f8b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAnimationParticleSpinTest/UIAnimationParticleSpin.test.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAnimationParticleSpin() { + + describe('UIAnimationParticleSpin', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_SPIN_0090 + * @tc.name SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_SPIN_0090 + * @tc.desc UIObserver + */ + it('SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_SPIN_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_SPIN_0090 start.`); + Settings.createWindow("testability/pages/UIAnimationParticleSpin/UIAnimationParticleSpin0090"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_MOTION_ANIMATION_PARTICLEOPTIONS_SPIN_0090 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..b1750977e7b1f95f752ba8ed7b76ad0d4d5f7462 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton001.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton001() { + + describe('UIAttributeFontInterfaceButton001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0070_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a7fc717416cfbf55b2fa6f13ca7001472734624b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton002.test.ets @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton002() { + + describe('UIAttributeFontInterfaceButton002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_01')); + let button2: Component = await driver.findComponent(ON.id('button_02')); + let button3: Component = await driver.findComponent(ON.id('button_03')); + let button4: Component = await driver.findComponent(ON.id('button_04')); + await Utils.sleep(100); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_01')); + let button2: Component = await driver.findComponent(ON.id('button_02')); + let button3: Component = await driver.findComponent(ON.id('button_03')); + let button4: Component = await driver.findComponent(ON.id('button_04')); + await Utils.sleep(100); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0550_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..14bed62ef77846ee76b584f47dc52e0bdd195c3d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton003.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton003() { + + describe('UIAttributeFontInterfaceButton003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..e1a5e0f64a7112681ada275301b585acf43dde57 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton004.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton004() { + + describe('UIAttributeFontInterfaceButton004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0340_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0030_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0190.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0190.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..14da694491c509aff3a87ac4d309f7b7f53f95f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0190.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton0190() { + + describe('UIAttributeFontInterfaceButton0190', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0190_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0310.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0310.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..55032752838b2d481e4f29d532b37edf539e5ef9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0310.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton0310() { + + describe('UIAttributeFontInterfaceButton0310', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0310_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0320.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0320.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..70ec6c9b1b195d3a15c15864c8022b5369a17ba5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceButtonTest/UIAttributeFontInterfaceButton0320.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceButton0320() { + + describe('UIAttributeFontInterfaceButton0320', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_1 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_2 + * @tc.desc colorMode test button + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0320_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8e119c9e604007f2cd4a0a795354f883113f4246 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas001.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas001() { + + describe('UIAttributeFontInterfaceCanvas001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_1 + * @tc.desc Canvas-light test colorMode: LIGHT + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_2 + * @tc.desc Canvas-light test colorMode: LIGHT + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0630_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f416485aa944251e55629d8374e77c6e4e4e496c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas002.test.ets @@ -0,0 +1,104 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas002() { + + describe('UIAttributeFontInterfaceCanvas002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_1 + * @tc.desc Canvas-light test colorMode: null + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_2 + * @tc.desc Canvas-dark test colorMode: null + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0650_2 finish.`); + done(); + }) + }) +} + \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..29558df51a6c1109b11e6523a77117efada51fd7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas003.test.ets @@ -0,0 +1,104 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas003() { + + describe('UIAttributeFontInterfaceCanvas003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_1 + * @tc.desc Canvas + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_2 + * @tc.desc Canvas-dark + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0700_2 finish.`); + done(); + }) + }) +} + \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..370ae4c9406dc4e788a4ceb4e6a0a72b05d2f22f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas004.test.ets @@ -0,0 +1,103 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas004() { + + describe('UIAttributeFontInterfaceCanvas004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_1 + * @tc.desc Canvas-light test colorMode: DARK + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_2 + * @tc.desc Canvas-DARK test colorMode: DARK + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004"); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error:Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0490_2 finish.`); + done(); + }) + }) +} + \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fb6671aae28e155343adaf9526d76077f11cc0e9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas005.test.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas005() { + + describe('UIAttributeFontInterfaceCanvas005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_1 + * @tc.desc Canvas-light test colorMode: System + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_2 + * @tc.desc Canvas-dark test colorMode: System + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005"); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0500_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a172f6e7be3b4f475b6182c7ecf3d5cf9b38ab82 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas006.test.ets @@ -0,0 +1,133 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas006() { + + describe('UIAttributeFontInterfaceCanvas006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_1 + * @tc.desc Canvas-light test custom colorMode + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(500); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006"); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('button_01')); + let button2: Component = await driver.findComponent(ON.id('button_02')); + let button3: Component = await driver.findComponent(ON.id('button_03')); + let button4: Component = await driver.findComponent(ON.id('button_04')); + await Utils.sleep(100); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_2 + * @tc.desc Canvas-dark test custom colorMode + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(500); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006"); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('button_01')); + let button2: Component = await driver.findComponent(ON.id('button_02')); + let button3: Component = await driver.findComponent(ON.id('button_03')); + let button4: Component = await driver.findComponent(ON.id('button_04')); + await Utils.sleep(100); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0510_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fcfb1d6f0b8746571933ae64a50ee1fe04b5e1e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCanvasTest/UIAttributeFontInterfaceCanvas007.test.ets @@ -0,0 +1,107 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCanvas007() { + + describe('UIAttributeFontInterfaceCanvas007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_1 + * @tc.desc Canvas-light test custom colorMode + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(500); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_2 + * @tc.desc Canvas-dark test custom colorMode + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(500); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0160_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f1767d56f5c8d78be75a2090bc095dcf80802002 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle001.test.ets @@ -0,0 +1,104 @@ + /* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfaceCircle001() { + + describe('UIAttributeFontInterfaceCircle001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_1 + * @tc.desc WithTheme:Circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_2 + * @tc.desc WithTheme:Circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0100_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fac3c71c2c394732f23074f1a911dfdda1a46b19 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle002.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle002() { + + describe('UIAttributeFontInterfaceCircle002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_1 + * @tc.desc WithTheme:Circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_2 + * @tc.desc WithTheme:Circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0690_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..46b9e982a671784cff3fc00f540f834c17c9bbb8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle003.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle003() { + + describe('UIAttributeFontInterfaceCircle003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_1 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_1 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_2 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_2 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0460_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..dde72b640dc00fd6fc96770915610472f1897738 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle004.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle004() { + + describe('UIAttributeFontInterfaceCircle004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_1 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_1 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_2 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_2 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0670_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..5d3dfe4d3459d314afc210575f90e3d9169eac88 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle005.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle005() { + + describe('UIAttributeFontInterfaceCircle005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_1 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_1 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_2 + * @tc.name ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_2 + * @tc.desc WithTheme:Circle + */ + it('ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUICOMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0060_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0210.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0210.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..378aca5919a3b89cdfab844a59e096a12591937c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0210.test.ets @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle0210() { + + describe('UIAttributeFontInterfaceCircle0210', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_1 + * @tc.desc colorMode test circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0210_01')); + let button2: Component = await driver.findComponent(ON.id('button_0210_02')); + let button3: Component = await driver.findComponent(ON.id('button_0210_03')); + let button4: Component = await driver.findComponent(ON.id('button_0210_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_2 + * @tc.desc colorMode test circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0210_01')); + let button2: Component = await driver.findComponent(ON.id('button_0210_02')); + let button3: Component = await driver.findComponent(ON.id('button_0210_03')); + let button4: Component = await driver.findComponent(ON.id('button_0210_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0210_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0270.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0270.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..e00454ea16603c3618de2b9ad21375852aa2aebd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCircleTest/UIAttributeFontInterfaceCircle0270.test.ets @@ -0,0 +1,102 @@ + +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCircle0270() { + + describe('UIAttributeFontInterfaceCircle0270', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_1 + * @tc.desc colorMode test circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_2 + * @tc.desc colorMode test circle + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0270_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..16a940aec6c437c9bc261d3a730d50bfdc1f183a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog001.test.ets @@ -0,0 +1,120 @@ + + /* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0160: + * 验证CheckBoxGroup组件动态切换浅色模式-深色模式正常切换 + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfaceCustomDialog001() { + + describe('UIAttributeFontInterfaceCustomDialog001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0090_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a53c174fd447da7f229778b608957011436f2640 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog002.test.ets @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog002() { + + describe('UIAttributeFontInterfaceCustomDialog002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0540_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..7fb5ade4f5482e5b02160987931ffd8632c283e8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog003.test.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog003() { + + describe('UIAttributeFontInterfaceCustomDialog003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0230_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..995abde9d02bb9adfda4411279c1504997ec34b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog004.test.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog004() { + + describe('UIAttributeFontInterfaceCustomDialog004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0260_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..bfc339de58ab03c217c3aebf798f2eba6a5df446 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog005.test.ets @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog005() { + + describe('UIAttributeFontInterfaceCustomDialog005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_1 + * @tc.desc colorMode test CustomDialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0050_01')); + let button2: Component = await driver.findComponent(ON.id('button_0050_02')); + let button3: Component = await driver.findComponent(ON.id('button_0050_03')); + let button4: Component = await driver.findComponent(ON.id('button_0050_04')); + let customDialog_01: Component = await driver.findComponent(ON.text('show Dialog01')); + let customDialog_02: Component = await driver.findComponent(ON.text('show Dialog02')); + let customDialog_03: Component = await driver.findComponent(ON.text('show Dialog03')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await button3.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_2 + * @tc.desc colorMode test CustomDialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0050_01')); + let button2: Component = await driver.findComponent(ON.id('button_0050_02')); + let button3: Component = await driver.findComponent(ON.id('button_0050_03')); + let button4: Component = await driver.findComponent(ON.id('button_0050_04')); + let customDialog_01: Component = await driver.findComponent(ON.text('show Dialog01')); + let customDialog_02: Component = await driver.findComponent(ON.text('show Dialog02')); + let customDialog_03: Component = await driver.findComponent(ON.text('show Dialog03')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(500); + await customDialog_01.click(); + await Utils.sleep(500); + await customDialog_02.click(); + await Utils.sleep(500); + await customDialog_03.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0330_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f91029dee31b2aa539b64f5de09600af6a4c7f07 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog006.test.ets @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog006() { + + describe('UIAttributeFontInterfaceCustomDialog006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(600); + let driver: Driver = Driver.create(); + await driver.delayMs(100); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await driver.delayMs(100); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await driver.delayMs(100); + await button1.click(); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0370_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..a5c6a34122a881d262a94124c7e4d3a9fc68ac2a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog007.test.ets @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0160: + * 验证CheckBoxGroup组件动态切换浅色模式-深色模式正常切换 + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog007() { + + describe('UIAttributeFontInterfaceCustomDialog007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_1 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await driver.delayMs(100); + await button1.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_2 + * @tc.desc WithTheme:dialog + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007"); + let driver: Driver = Driver.create(); + await driver.delayMs(600); + let button1: Component = await driver.findComponent(ON.id('1')); + await driver.delayMs(100); + await button1.click(); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0450_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog0330.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog0330.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..c32f6b200bf75c06e277d81dd0c32d2cce3873a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceCustomDialogTest/UIAttributeFontInterfaceCustomDialog0330.test.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceCustomDialog0330() { + + describe('UIAttributeFontInterfaceCustomDialog0330', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceDarkModeTest/UIAttributeFontInterfaceDarkMode001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceDarkModeTest/UIAttributeFontInterfaceDarkMode001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..d7327290f21215629b9757df0f13e0aff9835e5d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceDarkModeTest/UIAttributeFontInterfaceDarkMode001.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceDarkMode001() { + + describe('UIAttributeFontInterfaceDarkMode001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_DARKMODE_0040 + * @tc.name SUB_ACE_UI_COMPONENT_DARKMODE_0040 + * @tc.desc colorMode test + */ + it('SUB_ACE_UI_COMPONENT_DARKMODE_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_DARKMODE_0040 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0040"); + await Utils.sleep(1000); + let divider: Component = await driver.findComponent(ON.id('divider_0040')); + let point = await divider.getBounds(); + await driver.mouseMoveTo({ + x: point.right - 50, y: point.top - 30 + }) + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_DARKMODE_0040 finish.`); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_DARKMODE_0050 + * @tc.name SUB_ACE_UI_COMPONENT_DARKMODE_0050 + * @tc.desc colorMode test + */ + it('SUB_ACE_UI_COMPONENT_DARKMODE_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_DARKMODE_0050 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0050"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_DARKMODE_0050 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..819862bf657b51d0f8dfd67dfbe4c696d6eef6b3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage001.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage001() { + + describe('UIAttributeFontInterfaceImage001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001"); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0050_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f1b4e08ef3658c2b9fcb0129b9f5944bf08b008a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage002.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage002() { + + describe('UIAttributeFontInterfaceImage002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0110_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..327428f17c4e143530f579de65469c2bafee0346 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage003.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage003() { + + describe('UIAttributeFontInterfaceImage003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0120_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..c563a71f7592658879e2edc5a02c2072294f9f79 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage004.test.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage004() { + + describe('UIAttributeFontInterfaceImage004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0520_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6ba6bd4ab1fdb25132c012afcc17821ad960f666 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage005.test.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage005() { + + describe('UIAttributeFontInterfaceImage005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0390_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..79dc8d872c786989ba353c5402680caa0cc75d3d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage006.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage006() { + + describe('UIAttributeFontInterfaceImage006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_1 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006"); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_2 + * @tc.desc WithTheme:Image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0440_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage0220.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage0220.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..ff7177d385f3852afe3a670501e0f7428135fddf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceImageTest/UIAttributeFontInterfaceImage0220.test.ets @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceImage0220() { + + describe('UIAttributeFontInterfaceImage0220', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_1 + * @tc.desc colorMode test image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0220_01')); + let button2: Component = await driver.findComponent(ON.id('button_0220_02')); + let button3: Component = await driver.findComponent(ON.id('button_0220_03')); + let button4: Component = await driver.findComponent(ON.id('button_0220_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_2 + * @tc.desc colorMode test image + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0220_01')); + let button2: Component = await driver.findComponent(ON.id('button_0220_02')); + let button3: Component = await driver.findComponent(ON.id('button_0220_03')); + let button4: Component = await driver.findComponent(ON.id('button_0220_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0220_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6f9746b97bffcf135cab67772e7943f332fdb6a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu001.test.ets @@ -0,0 +1,336 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu001() { + + describe('UIAttributeFontInterfaceMenu001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('2')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_2 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('3')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(1000) + let submenu: Component = await driver.findComponent(ON.text('show WithThemeThree')); + await Utils.sleep(1000) + await submenu.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_4 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_4 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_4', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('4')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(1000) + let submenu: Component = await driver.findComponent(ON.text('show WithThemeThree')); + await Utils.sleep(1000) + await submenu.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_4 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_5 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_5 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_5', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_5 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_5 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_6 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_6 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_6', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_6 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('2')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_6 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_7 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_7 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_7', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_7 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('3')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(1000) + let submenu: Component = await driver.findComponent(ON.text('show WithThemeThree')); + await Utils.sleep(1000) + await submenu.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_7 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_8 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_8 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_8', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_8 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('4')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(1000) + let menu0010_text: Component = await driver.findComponent(ON.id('menu0010_text')); + await Utils.sleep(1000) + await menu0010_text.click(); + await Utils.sleep(1000) + let submenu: Component = await driver.findComponent(ON.text('show WithThemeThree')); + await Utils.sleep(1000) + await submenu.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0010_8 finish.`); + done(); + }) + }) +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..beb635a40d60f419b9c7d12aca871e5cad657823 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu002.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu002() { + + describe('UIAttributeFontInterfaceMenu002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0040_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..9fbb143b68d68fca17add4c9457e19bd02544991 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu003.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu003() { + + describe('UIAttributeFontInterfaceMenu003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0080_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..2502201cf1bef102e2308c286949b6aa4d991563 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu004.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu004() { + + describe('UIAttributeFontInterfaceMenu004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0580_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..ab190000e363c853ed815522e5be09767f5df74f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu005.test.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu005() { + + describe('UIAttributeFontInterfaceMenu005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0290_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..85f3ff47722db1c8c426cc789981acbf972c88c0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu006.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu006() { + + describe('UIAttributeFontInterfaceMenu006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0430_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0a1eecd621ccd9896ada72d985dbcba0dfb79e9c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceMenuTest/UIAttributeFontInterfaceMenu007.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceMenu007() { + + describe('UIAttributeFontInterfaceMenu007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0130_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..bff222dbee101861582bdb99c10ae21882aa748c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup001.test.ets @@ -0,0 +1,105 @@ + + /* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfacePopup001() { + + describe('UIAttributeFontInterfacePopup001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0020_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..9a97410594b326c20ff3f3b036366c651d45b49d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup002.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup002() { + + describe('UIAttributeFontInterfacePopup002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..257323dc97cf60b5599b8c48ce99f479db87f754 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup003.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup003() { + + describe('UIAttributeFontInterfacePopup003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0640_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..4512f40ce840139cfa66feba76fb7190b5c1997a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup004.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup004() { + + describe('UIAttributeFontInterfacePopup004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_2 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0530_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1042325b44a65419f5ea46ce846eb2d7f0c6ef27 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup005.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup005() { + + describe('UIAttributeFontInterfacePopup005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..47464ca752c95f41373bc6b34b75f4d0b444faa2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup006.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup006() { + + describe('UIAttributeFontInterfacePopup006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_1 + * @tc.desc WithTheme:Menu + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0250_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0590_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..ffe265806f2e258fba8765a7f5c1d7fbda4e0c22 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfacePopupTest/UIAttributeFontInterfacePopup007.test.ets @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfacePopup007() { + + describe('UIAttributeFontInterfacePopup007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_1 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_1 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_2 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('2')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_2 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_3 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_3 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_3', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('3')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_3 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_4 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_4 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_4', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_4 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('4')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_4 finish.`); + done(); + }) + + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_5 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_5 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_5', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_5 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('1')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_5 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_6 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_6 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_6', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_6 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('2')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_6 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_7 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_7 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_7', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('3')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_7 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8 + * @tc.desc WithTheme:popup + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Settings.createWindow("testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let button1: Component = await driver.findComponent(ON.id('4')); + await Utils.sleep(1000) + await button1.click(); + await Utils.sleep(2000) + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0410_8 finish.`); + done(); + }) + }) +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..526e62cbe666ab253c9abbad54fed17fd4d07b6d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider001.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfaceSlider001() { + + describe('UIAttributeFontInterfaceSlider001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0360_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..91ccc6c9fa0bfd0d0ba281b65b554c5e5baa0cb6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider002.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider002() { + + describe('UIAttributeFontInterfaceSlider002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0620_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f09ba6d2773963c5b7f92542be1a4f2811188411 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider003.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider003() { + + describe('UIAttributeFontInterfaceSlider003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0240_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1e6d3779639edefe7b8f10dcba3a1808011fae25 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider004.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider004() { + + describe('UIAttributeFontInterfaceSlider004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0680_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f0df0f5b0109cbf69ad5cf52940bc9067fd8f8d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider005.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider005() { + + describe('UIAttributeFontInterfaceSlider005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0570_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f4b6443328f48f825f0da399307d850520cf7824 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider006.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider006() { + + describe('UIAttributeFontInterfaceSlider006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0470_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..eb2e5fdc9ffe4684bb08d2cd3281f0f58139a189 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider007.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider007() { + + describe('UIAttributeFontInterfaceSlider007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_1 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_2 + * @tc.desc WithTheme:slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0560_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider0180.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider0180.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6e67678067fbbcb2729d8d4f879532148da4e4c0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceSliderTest/UIAttributeFontInterfaceSlider0180.test.ets @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceSlider0180() { + + describe('UIAttributeFontInterfaceSlider0180', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_1 + * @tc.desc colorMode test slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0180_01')); + let button2: Component = await driver.findComponent(ON.id('button_0180_02')); + let button3: Component = await driver.findComponent(ON.id('button_0180_03')); + let button4: Component = await driver.findComponent(ON.id('button_0180_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_2 + * @tc.desc colorMode test slider + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_2 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180"); + await Utils.sleep(500); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('button_0180_01')); + let button2: Component = await driver.findComponent(ON.id('button_0180_02')); + let button3: Component = await driver.findComponent(ON.id('button_0180_03')); + let button4: Component = await driver.findComponent(ON.id('button_0180_04')); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button1.click(); + await Utils.sleep(500); + await button2.click(); + await Utils.sleep(500); + await button3.click(); + await Utils.sleep(500); + await button4.click(); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0180_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..6fecedfc3c421a8264824bf6a0c8ee0303d641ba --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText001.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfaceText001() { + + describe('UIAttributeFontInterfaceText001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0660_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..261ba1e7a2e7ec1dc296dc2c5fb32575af66428d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText002.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText002() { + + describe('UIAttributeFontInterfaceText002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0170_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..b99b6a88b45ecb76ef915eb46e7036888e2e8a6a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText003.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/*/ + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText003() { + + describe('UIAttributeFontInterfaceText003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0350_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8ab737d42d1853261892e5b30a449a3e237a6f85 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText004.test.ets @@ -0,0 +1,281 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText004() { + + describe('UIAttributeFontInterfaceText004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_1 finish.`); + done(); + }) + + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_2 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn2')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_4 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_4 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_4', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_4 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn2')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_4 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_5 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_5 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_5', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_5 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_6 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_6 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_6', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_6 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_6 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_7 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_7 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_7', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_7 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_7 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_8 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_8 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_8', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_8 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0420_8 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1abd984b9f06f32f2a0ec3dabce2c8bff185ec40 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText005.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText005() { + + describe('UIAttributeFontInterfaceText005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0610_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0140.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0140.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..c158fdd00022c489169cab190b612e11b559a3b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0140.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText0140() { + + describe('UIAttributeFontInterfaceText0140', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_1 + * @tc.desc colorMode test text + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_2 + * @tc.desc colorMode test Text + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0140_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0200.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0200.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..218ccbb57decd44b808129d887d31a5fc99e3117 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceTextTest/UIAttributeFontInterfaceText0200.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceText0200() { + + describe('UIAttributeFontInterfaceText0200', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_1 + * @tc.desc colorMode test text + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_1 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_2 + * @tc.desc colorMode test Text + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0200_2 finish.`); + done(); + }) + }) +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..695fd909f731ebc2d17bb9192266dddd6e8a9820 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo001.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo001() { + + describe('UIAttributeFontInterfaceVideo001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0150_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo002.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo002.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fabbfa512db7639da0e8a8c39fc48f29e1f57efa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo002.test.ets @@ -0,0 +1,106 @@ + /* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' + import Settings from '../model/Settings' + import windowSnap from '../model/snapShot' + import Logger from '../model/Logger' + import Utils from '../model/Utils' + + import { Component, Driver ,ON } from '@ohos.UiTest' + import uiAppearance from '@ohos.uiAppearance' + + /* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + + export default function UIAttributeFontInterfaceVideo002() { + + describe('UIAttributeFontInterfaceVideo002', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0600_2 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo003.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo003.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..31046a520450834a38c263b0b901b580125dd34b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo003.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo003() { + + describe('UIAttributeFontInterfaceVideo003', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo004.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo004.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..007b6301535fad82ec6f5812b37a17f47ea5e172 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo004.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo004() { + + describe('UIAttributeFontInterfaceVideo004', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0380_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0480_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo005.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo005.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..be7981f018cddfc0f20069954cb69dd1af151054 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo005.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo005() { + + describe('UIAttributeFontInterfaceVideo005', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0400_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo006.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo006.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..1cc83d2f7ae94388a8365617cd85f35ee0361476 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo006.test.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo006() { + + describe('UIAttributeFontInterfaceVideo006', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0280_2 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo007.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo007.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..d27a288fb9deaa28372f08b657ec67018e9447d9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributeFontInterfaceVideoTest/UIAttributeFontInterfaceVideo007.test.ets @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIAttributeFontInterfaceVideo007() { + + describe('UIAttributeFontInterfaceVideo007', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_1 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_1 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_1', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_1 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_1 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_2 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_2 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_2', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_2 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_2 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn2')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_4 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_4 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_4', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_4 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn2')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_4 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_5 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_5 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_5', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_3 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_5 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_6 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_6 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_6', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_6 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_6 finish.`); + done(); + }) + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_7 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_7 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_7', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_7 start.`); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_7 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_8 + * @tc.name ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_8 + * @tc.desc WithTheme + */ + it('ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_8', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_8 start.`); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.info('Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Set dark-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Settings.createWindow("testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000) + let btn: Component = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000) + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Set light-mode successfully.'); + }).catch((error: Error) => { + console.error('Set light-mode failed, ' + error.message); + }); + await Utils.sleep(2000); + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_RESOURCETHEME_FORCEDARKLIGHT_0300_8 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..4af36a3ebfeae37265072aaf0c1bb296f0664873 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement.test.ets @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Driver, ON } from '@kit.TestKit' + +export default function UIComponentPopupBoxActionsheetInterfaceReplacement() { + + describe('UIComponentPopupBoxActionsheetInterfaceReplacement', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0320 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0320 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0320', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0320 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0320"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0320 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0300 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0300 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0300', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0300 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0300"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0300 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0230 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0230 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0230 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0230"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let confirm = await driver.findComponent(ON.text('ConfirmButton')); + await confirm.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0230 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0290 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0290 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0290', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0290 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0290"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0290 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0270 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0270 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0270', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0270 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0270"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0270 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280_1 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBoundsCenter(); + await driver.click(point.x+100,point.y); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0280_1 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0310 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0310 + * @tc.desc :ActionSheet + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0310', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0310 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0310"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ACTIONSHEET_INTERFACE_0310 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..b699932f3b89077158e4da226ff95ee17539d548 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement.test.ets @@ -0,0 +1,440 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Driver, ON } from '@ohos.UiTest' + +export default function UIComponentPopupBoxAlertDialogInterfaceReplacement() { + + describe('UIComponentPopupBoxAlertDialogInterfaceReplacement', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0390 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0390 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0390', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0390 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0390"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0390 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0690 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0690 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0690', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0690 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0690"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0690 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0240 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0240 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0240', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0240 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0240"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0240 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130_1 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBoundsCenter(); + await driver.click(point.x + 100, point.y); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0130_1 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570_1 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBoundsCenter(); + await driver.click(point.x + 100, point.y); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0570_1 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560_1 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBoundsCenter(); + await driver.click(point.x + 100, point.y); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0560_1 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0230 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0230 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0230 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0230"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0230 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0140 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0140 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0140', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0140 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0140"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0140 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270_1 + * @tc.desc :AlertDialog + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let primaryButton = await driver.findComponent(ON.text('primaryButton')); + await primaryButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0270_1 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0780 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0780 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0780', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0780 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0780"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0780 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0800 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0800 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0800', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0800 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0800"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0800 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370_1 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370_1 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let primaryButton = await driver.findComponent(ON.text('primaryButton')); + await primaryButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0370_1 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280_1 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280_1 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(1000); + let primaryButton = await driver.findComponent(ON.text('secondaryButton')); + await primaryButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0280_1 finish.`); + done(); + }) + /* +* @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0410 +* @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0410 +* @tc.desc :AlertDialog +*/ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0410', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0410 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0410"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('show')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0410 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..e507afb25780ce74d3138beee765bc5ce7c4a83f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement.test.ets @@ -0,0 +1,116 @@ + /* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + + import { Driver, MouseButton, ON } from '@ohos.UiTest' +import { JSON } from '@kit.ArkTS' + + export default function UIComponentPopupBoxCalendarPickerFeatureReplacement() { + + describe('UIComponentPopupBoxCalendarPickerFeatureReplacement', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + it('SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0010', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0010 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0010"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('UIComponentPopupBoxCalendarPickerFeatureReplacement0010')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBounds(); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(100); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(100); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0010 finish.`); + done(); + }) + it('SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0010 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0020"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('UIComponentPopupBoxCalendarPickerFeatureReplacement0020')); + await show.click(); + await Utils.sleep(1000); + let point = await show.getBounds(); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(100); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(100); + await driver.mouseClick({x:point.right-20,y:point.top+5},MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(100); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0020 finish.`); + done(); + }) + it('SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0030 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0030"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('UIComponentPopupBoxCalendarPickerFeatureReplacement0030')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0030 finish.`); + done(); + }) + it('SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0040 start.`); + Settings.createWindow("testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0040"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let show = await driver.findComponent(ON.id('UIComponentPopupBoxCalendarPickerFeatureReplacement0040')); + await show.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0040 finish.`); + done(); + }) + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..020fcfd16f3115ce9de2c5a72dddf15c7074ab92 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement.test.ets @@ -0,0 +1,485 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Driver, ON } from '@kit.TestKit' + +export default function UIComponentPopupboxMenuStyleEnhancementReplacement() { + + describe('UIComponentPopupboxMenuStyleEnhancementReplacement', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0530 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0530 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0530', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0530 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0530"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0530 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0640 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0640 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0640', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0640 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0640"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0640 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0610 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0610 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0610', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0610 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0610"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0610 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0620 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0620 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0620', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0620 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0620"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0620 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0650 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0650 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0650', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0650 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0650"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0650 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0630 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0630 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0630', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0630 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0630"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0630 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0370 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0370 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0370', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0370 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0370"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0370 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0380 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0380 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0380', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0380 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0380"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0380 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0360 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0360 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0360', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0360 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0360"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0360 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0350 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0350 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0350', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0350 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0350"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0350 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0400 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0400 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0400', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0400 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0400"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0400 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0410 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0410 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0410', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0410 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0410"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0410 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0390 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0390 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0390', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0390 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0390"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0390 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0420 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0420 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0420', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0420 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0420"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0420 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0440 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0440 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0440', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0440 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0440"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0440 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0430 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0430 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0430', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0430 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0430"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0430 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_1030 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_1030 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_1030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_1030 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement1030"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(1000); + let menu = await driver.findComponent(ON.type('MenuItem')); + await menu.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_1030 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290_1 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290_1 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290_1 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('noDiv')); + await btn.click(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0290_1 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0300 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0300 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0300', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0300 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0300"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0300 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0680 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0680 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0680', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0680 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0680"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0680 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0670 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0670 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0670', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0670 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0670"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0670 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0310 + * @tc.name : SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0310 + * @tc.desc :menu + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0310', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0310 start.`); + Settings.createWindow("testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0310"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('display')); + await button.longClick(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_MENU_STYLE_ENHANCEMENT_0310 finish.`); + done(); + }) + + }) + } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..54ca2c52baef2af012a699c9ec94372aa1908a42 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement.test.ets @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Driver, ON } from '@kit.TestKit' + +export default function UIComponentUISupportColorReplacement() { + + describe('UIComponentUISupportColorReplacement', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0570 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0570 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0570', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0570 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0570"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('change')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0570 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0610 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0610 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0610', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0610 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0610"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0610 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0600 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0600 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0600', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0600 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0600"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('change')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0600 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0630 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0630 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0630', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0630 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0630"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0630 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0590 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0590 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0590', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0590 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0590"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('change')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0590 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0580 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0580 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0580', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0580 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0580"); + await Utils.sleep(1000); + const driver = Driver.create(); + await Utils.sleep(1000); + let button = await driver.findComponent(ON.id('change')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0580 finish.`); + done(); + }) + /* + * @tc.number : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0620 + * @tc.name : SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0620 + * @tc.desc :theme + */ + it('SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0620', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0620 start.`); + Settings.createWindow("testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0620"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_UISUPPORT_COLOR_0620 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponmentCanvasModifierReplacementTest/UIComponmentCanvasModifierReplacement001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponmentCanvasModifierReplacementTest/UIComponmentCanvasModifierReplacement001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..11df265b42ff5adef4a0653c3cb21aa7eb9f72b8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponmentCanvasModifierReplacementTest/UIComponmentCanvasModifierReplacement001.test.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIComponmentCanvasModifierReplacement001() { + + describe('UIComponmentCanvasModifierReplacement001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MODIFIER_1240 + * @tc.name SUB_ACE_UI_COMPONENT_CANVAS_MODIFIER_1240 + * @tc.desc canvas + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MODIFIER_1240', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MODIFIER_1240 start.`); + Settings.createWindow("testability/pages/UIComponmentCanvasModifierReplacement/UIComponmentCanvasModifierReplacement1240"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MODIFIER_1240 finish.`); + done(); + }) + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxAlertDialogCalendarPickerReplacementTest/UIPopuBoxAlertDialogCalendarPickerReplacement001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxAlertDialogCalendarPickerReplacementTest/UIPopuBoxAlertDialogCalendarPickerReplacement001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..58edb8ad086dfdd18d6d50f7e2566e0aafa94e09 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxAlertDialogCalendarPickerReplacementTest/UIPopuBoxAlertDialogCalendarPickerReplacement001.test.ets @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIPopuBoxAlertDialogCalendarPickerReplacement001() { + + describe('UIPopuBoxAlertDialogCalendarPickerReplacement001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0420 + * @tc.name SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0420 + * @tc.desc AlertDialog test + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0420', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0420 start.`); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIAlertDialogInterfaceReplacement0420"); + await Utils.sleep(1000); + let button: Component = await driver.findComponent(ON.id('UIAlertDialogInterfaceReplacement0420_button_01')); + await Utils.sleep(1000); + await button.click() + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_ALERTDIALOG_INTERFACE_0420 finish.`); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0050 + * @tc.name SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0050 + * @tc.desc CalendarPicker test + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0050 start.`); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIPopuBoxCalendarPickerFeatureReplacement0050"); + await Utils.sleep(1000); + let button: Component = await driver.findComponent(ON.id('UIPopuBoxCalendarPickerFeatureReplacement0050_button_01')); + await Utils.sleep(1000); + await button.click() + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_CALENDARPICKER_FEATURE_0050 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxSupportCustomIzationStyleReplacementTest/UIPopuBoxSupportCustomIzationStyleReplacement001.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxSupportCustomIzationStyleReplacementTest/UIPopuBoxSupportCustomIzationStyleReplacement001.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..986e30c3e386a4f8da5b1d99e19915d1d6b0f0ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIPopuBoxSupportCustomIzationStyleReplacementTest/UIPopuBoxSupportCustomIzationStyleReplacement001.test.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver, ON } from '@ohos.UiTest' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIPopuBoxSupportCustomIzationStyleReplacement001() { + + describe('UIPopuBoxSupportCustomIzationStyleReplacement001', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_SUPPORTCUSTOMIZATIONSTYLE_0830 + * @tc.name SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_SUPPORTCUSTOMIZATIONSTYLE_0830 + * @tc.desc MOST_TOP + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_SUPPORTCUSTOMIZATIONSTYLE_0830', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_SUPPORTCUSTOMIZATIONSTYLE_0830 start.`); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIPopuBoxSupportCustomIzationStyleReplacement0830"); + await Utils.sleep(500); + let button: Component = await driver.findComponent(ON.id('UIPopuBoxSupportCustomIzationStyle0830_button_01')); + await Utils.sleep(1000); + await button.click() + await Utils.sleep(2000); + await windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_SUPPORTCUSTOMIZATIONSTYLE_0830 finish.`); + done(); + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_SPECIFICATIONS_HAND_0060 + * @tc.name ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_SPECIFICATIONS_HAND_0060 + * @tc.desc MOST_TOP + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_SPECIFICATIONS_HAND_0060', 0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_SPECIFICATIONS_HAND_0060 start.`); + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIDialogSpeciFicationsHandReplacement0060"); + await Utils.sleep(500) + let button: Component = await driver.findComponent(ON.id('button_01')); + let textInput: Component = await driver.findComponent(ON.id('textInput_01')); + await Utils.sleep(1000); + await button.click() + await Utils.sleep(1000); + await textInput.click() + await Utils.sleep(2000); + await windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_SPECIFICATIONS_HAND_0060 finish.`); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIRenderComComponentTest/UIRenderComComponent.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIRenderComComponentTest/UIRenderComComponent.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f84905874b103baaf8f4004e4c2045c14964c837 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIRenderComComponentTest/UIRenderComComponent.test.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIRenderComComponent() { + + describe('UIRenderComComponent', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_RENDER_COM_COMPONENT_0020 + * @tc.name SUB_ACE_UI_RENDER_COM_COMPONENT_0020 + * @tc.desc Web + */ + it('SUB_ACE_UI_RENDER_COM_COMPONENT_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_RENDER_COM_COMPONENT_0020 start.`); + Settings.createWindow("testability/pages/UIRenderComComponent/UIRenderComComponent0020"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_RENDER_COM_COMPONENT_0020 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_RENDER_COM_COMPONENT_0030 + * @tc.name SUB_ACE_UI_RENDER_COM_COMPONENT_0030 + * @tc.desc Web + */ + it('SUB_ACE_UI_RENDER_COM_COMPONENT_0030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_RENDER_COM_COMPONENT_0030 start.`); + Settings.createWindow("testability/pages/UIRenderComComponent/UIRenderComComponent0020"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn2')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_RENDER_COM_COMPONENT_0030 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIWebDrawPipelineTest/UIWebDrawPipeline.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIWebDrawPipelineTest/UIWebDrawPipeline.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..b582d2e7ebccbceabdcc5471072ea65beb098c8d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIWebDrawPipelineTest/UIWebDrawPipeline.test.ets @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2024 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 { afterEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' + +import { Component, Driver ,ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' + +/* + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UIWebDrawPipeline() { + + describe('UIWebDrawPipeline', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return; + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0010 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0010 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0010', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0010 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010"); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0010 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0020 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0020 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0020 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010"); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0020 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0030 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0030 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0030 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0030 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0040 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0040 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0040 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0040 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0050 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0050 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0050 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0050 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0060 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0060 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0060', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0060 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn1')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0060 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_1 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_1 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_1 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn5')); + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_1 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_2 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_2 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_2 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn5')); + await Utils.sleep(1000); + await btn.click();; + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0070_2 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0080 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0080 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0080', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0080 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + await Utils.homeAndBack(driver); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0080 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0090 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0090 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0090 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn = await driver.findComponent(ON.id('btn6')); + await Utils.sleep(1000); + await btn.click();; + await Utils.sleep(1000); + await btn.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0090 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0100 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0100 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0100', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0100 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('btn1')); + let btn2 = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn2.click(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0100 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0110 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0110 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0110', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0110 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('btn2')); + let btn2 = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn2.click(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0110 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0120 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0120 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0120', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0120 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('btn1')); + let btn2 = await driver.findComponent(ON.id('btn3')); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn2.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0120 finish.`); + done(); + }) + /* + * @tc.number SUB_ACE_UI_WEB_DRAW_PIPELINE_0130 + * @tc.name SUB_ACE_UI_WEB_DRAW_PIPELINE_0130 + * @tc.desc Web + */ + it('SUB_ACE_UI_WEB_DRAW_PIPELINE_0130', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0130 start.`); + Settings.createWindow("testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050"); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(1000); + await Settings.changeOrientation(); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + let btn1 = await driver.findComponent(ON.id('btn2')); + let btn2 = await driver.findComponent(ON.id('btn4')); + await Utils.sleep(1000); + await btn1.click(); + await Utils.sleep(1000); + await btn2.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', `SUB_ACE_UI_WEB_DRAW_PIPELINE_0130 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets index 7f06aa4d872061e0682441fd8f47b33730bc78c1..33496bf795874b4d9efe75e5eb3b3bffa9bf00b0 100644 --- a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets @@ -14,6 +14,8 @@ */ import {Driver , ON} from '@ohos.UiTest' +import Settings from '../model/Settings' +import { KeyCode } from '@kit.InputKit'; export default class Utils { @@ -39,6 +41,20 @@ export default class Utils { } + /** + * The application switches to the desktop and back to the application + * + * @param driver + */ + static async homeAndBack(driver: Driver) { + let currentWindow = await Settings.windowClass; + if (currentWindow) { + await currentWindow.hide(); + await driver.triggerKey(KeyCode.KEYCODE_HOME); + await Utils.sleep(2000); + await currentWindow.showWindow(); + } + } } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXDraw/DFXDraw0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXDraw/DFXDraw0010.ets new file mode 100755 index 0000000000000000000000000000000000000000..ac56db0f29c569e824134a0bbd122c7d254dc111 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXDraw/DFXDraw0010.ets @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2024 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 { uiObserver as observer } from '@kit.ArkUI' + +@Entry +@Component +struct DFXDraw0010 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isShow: boolean = true + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + private scroller: Scroller = new Scroller() + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + @State observerRes1: string = 'UIObserver callback 1结果:\n' + @State visibVar: Visibility = Visibility.Visible + drawCommand = () => { + console.info("callback 1"); + this.observerRes1 += 'callback 1\n'; + } + + aboutToAppear() { + this.getUIContext().getUIObserver().on('willDraw', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes += 'willDraw callback\n'; + }) + this.getUIContext().getUIObserver().on('willDraw', this.drawCommand); + } + + build() { + Row() { + Column({ space: 5 }) { + TextInput({ text: 'Text:' + this.text }) + .fontSize(20) + .height(100) + .borderWidth(3) + .width('80%') + .visibility(this.visibVar) + + Text(this.observerRes1) + .fontSize(20) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .fontColor(Color.Brown) + .width('95%') + .borderWidth(2) + .height(280) + .maxLines(10) + Text(this.observerRes) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .maxLines(10) + .fontSize(20) + .fontColor(Color.Brown) + .width('95%') + .borderWidth(2) + .height(280) + Row({ space: 5 }) { + Button('切换Text显示').id('DFXDraw0010_btn1') + .onClick(() => { + this.visibVar = (this.visibVar == Visibility.Visible) ? Visibility.None : Visibility.Visible; + }) + Button('解除willDraw').id('DFXDraw0010_btn2') + .onClick(() => { + this.getUIContext().getUIObserver().off('willDraw', this.drawCommand); + this.observerRes1 = 'callback 1 UIObserver 关闭\n'; + }) + Button('解除所有willDraw').id('DFXDraw0010_btn3') + .onClick(() => { + this.getUIContext().getUIObserver().off('willDraw', this.drawCommand); + this.observerRes1 = 'callback 1 UIObserver 关闭\n'; + this.getUIContext().getUIObserver().off('willDraw'); + this.observerRes = 'willDraw UIObserver 关闭\n'; + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010.ets new file mode 100755 index 0000000000000000000000000000000000000000..78aca68d7e81b8482a6c108c5d45bee00a40dfd1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0010 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + scroller: Scroller = new Scroller() + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State scrollRes: string = '' + @State scrollSnap: ScrollSnapOptions | undefined = undefined + + build() { + Row() { + Column({ space: 10 }) { + Scroll(this.scroller) { + Column({ space: 10 }) { + TextInput({ text: 'Text01' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text02' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text03' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text04' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text05' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text06' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text07' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text08' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text09' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text10' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text11' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text12' + this.text }).height(100).fontSize(20) + } + } + .scrollSnap(this.scrollSnap) + .height(300) + .borderWidth(3) + .onScrollStart(() => { + this.res += 'onScrollStart回调咯\n' + }) + .onScrollEnd(() => { + this.res += 'onScrollEnd回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ scrollOffset=' + scrollOffset + + ' }\n'; + }) + + Text(this.res).fontSize(20).fontColor(Color.Brown) + Text(this.scrollRes).fontSize(20).fontColor(Color.Green) + Row({ space: 10 }) { + Button('scroll Page').id('ScrollEventObserver0010_btn2') + .onClick(() => { + this.scroller.scrollPage({ next: true }); + }) + Button('scrollToIndex').id('ScrollEventObserver0010_btn3') + .onClick(() => { + this.scroller.scrollToIndex(10); + }) + Button('scroll 200vp').id('ScrollEventObserver0010_btn4') + .onClick(() => { + this.scroller.scrollBy(0, 200); + }) + } + + Row({ space: 10 }) { + Button('scroll Bottom').id('ScrollEventObserver0010_btn1') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + + Button('scroll Top').id('ScrollEventObserver0010_btn5') + .onClick(() => { + this.scroller.scrollEdge(Edge.Top); + }) + Button('设置限位滚动模式').id('ScrollEventObserver0010_btn6') + .onClick(() => { + this.scrollSnap = { + snapAlign: ScrollSnapAlign.START, + snapPagination: 200, + enableSnapToStart: true, + enableSnapToEnd: true + } + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0020.ets new file mode 100755 index 0000000000000000000000000000000000000000..565c6c1bb56828cb17484776b267d1a34e2b0e12 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0020.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0020 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State dataArray: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + private scroller: ListScroller = new ListScroller() + @State listChildrenSize: ChildrenMainSize = new ChildrenMainSize(50) + + aboutToAppear() { + // 初始化数据源。 + for (let i = 0; i < 10; i++) { + this.dataArray.push(i) + } + // 前5个item的主轴大小不是默认大小100,因此需要通过ChildrenMainSize通知List。 + this.listChildrenSize.splice(0, 5, [300, 300, 300, 300, 300]) + } + + build() { + Row() { + Column({ space: 10 }) { + List({ space: 12, initialIndex: 0, scroller: this.scroller }) { + ForEach(this.dataArray, (item: number) => { + ListItem() { + Text('Text:' + item) + .width('90%') + .height(item < 5 ? 100 : this.listChildrenSize.childDefaultSize) + .backgroundColor('#FFabcd12') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + .borderWidth(1) + } + }, (item: number) => item.toString()) + } + .id('ScrollEventObserver0010') + .height('80%') + .width('100%') + .margin({ top: 12, left: '10%' }) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset + + ' }\n'; + }) + + Text(this.res + this.startRes + this.scrollRes + this.startRes).fontSize(20).fontColor(Color.Brown) + Button('scroll').id('scroll_btn').onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + .width('100%') + } + .height('50%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030.ets new file mode 100755 index 0000000000000000000000000000000000000000..7a94fde5960d6fab62fd18b410345ca181a61f49 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030.ets @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0030 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollListener: boolean = true; + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = 'Grid测试结果:\n' + @State observerRes: string = 'UIObserver结果:\\n' + @State numbers: String[] = ['0', '1', '2', '3', '4'] + @State gridPosition: number = 0 //0代表滚动到grid顶部,1代表中间值,2代表滚动到grid底部。 + scroller: Scroller = new Scroller() + + aboutToAppear(): void { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + }else { + console.log('[Test] scrollEvent: UIObserver off'); + } + } + + build() { + Column({ space: 5 }) { + Grid(this.scroller) { + ForEach(this.numbers, (day: string) => { + ForEach(this.numbers, (day: string) => { + GridItem() { + Text(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height(80) + .textAlign(TextAlign.Center) + } + }, (day: string) => day) + }, (day: string) => day) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .friction(0.6) + .enableScrollInteraction(true) + .supportAnimation(false) + .multiSelectable(false) + .edgeEffect(EdgeEffect.Spring) + .scrollBar(BarState.On) + .scrollBarColor(Color.Grey) + .scrollBarWidth(4) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset + ' }\n'; + }) + .onScrollStart(() => { + this.startRes = 'onScrollStart回调咯\n' + console.info("TEST" + "Grid onScrollStart") + }) + .onScrollStop(() => { + this.endRes = 'onScrollStop回调咯\n' + console.info("TEST" + "Grid onScrollStop") + }) + .onReachStart(() => { + this.gridPosition = 0 + console.info("TEST" + "Grid onReachStart") + }) + .onReachEnd(() => { + this.gridPosition = 2 + console.info("TEST" + "Grid onReachEnd") + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0030_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0030_btn2') + .onClick(() => { + this.scroller.scrollPage({next:true}); + }) + } + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040.ets new file mode 100755 index 0000000000000000000000000000000000000000..2a5ab9add4ad7b2559ecd90b3fb53b9f6763053d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040.ets @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0040 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State dataArray: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + private scroller: ListScroller = new ListScroller() + @State listChildrenSize: ChildrenMainSize = new ChildrenMainSize(50) + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + aboutToAppear() { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + // 初始化数据源。 + for (let i = 0; i < 10; i++) { + this.dataArray.push(i) + } + // 前5个item的主轴大小不是默认大小100,因此需要通过ChildrenMainSize通知List。 + this.listChildrenSize.splice(0, 5, [300, 300, 300, 300, 300]) + } + + build() { + Row() { + Column({ space: 10 }) { + List({ space: 12, initialIndex: 0, scroller: this.scroller }) { + ForEach(this.dataArray, (item: number) => { + ListItem() { + Text('Text:' + item) + .width('90%') + .height(item < 5 ? 100 : this.listChildrenSize.childDefaultSize) + .backgroundColor('#FFabcd12') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + .borderWidth(1) + } + }, (item: number) => item.toString()) + } + .id('ScrollEventObserver0010') + .height('50%') + .width('100%') + .margin({ top: 12, left: '10%' }) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset + ' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0040_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭' + } + }) + Button('scroll Bottom').id('ScrollEventObserver0040_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050.ets new file mode 100755 index 0000000000000000000000000000000000000000..dd4110615f2ad35c4cf18392307ce4c866a6ad0c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050.ets @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2024 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 { uiObserver as observer } from '@kit.ArkUI' + +@Entry +@Component +struct DFXScrollEventObserver0050 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + private scroller: Scroller = new Scroller() + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + aboutToAppear() { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + } + + build() { + Row() { + Column({ space: 10 }) { + Scroll(this.scroller) { + Column({ space: 10 }) { + TextInput({ text: 'Text01' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text02' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text03' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text04' + this.text }).height(100).fontSize(20) + } + }.height(300).borderWidth(3) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ scrollOffset=' + scrollOffset + ' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0050_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0050_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060.ets new file mode 100755 index 0000000000000000000000000000000000000000..6afcfaa09dcc9857ca5025f1b4b7295d7940f4cc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060.ets @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2024 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 { WaterFlowDataSource } from './WaterFlowDataSource' + +@Entry +@Component +struct DFXScrollEventObserver0060 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + + @State minSize: number = 80 + @State maxSize: number = 180 + @State fontSize: number = 24 + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F] + scroller: Scroller = new Scroller() + dataSource: WaterFlowDataSource = new WaterFlowDataSource() + private itemWidthArray: number[] = [] + private itemHeightArray: number[] = [] + + // 计算FlowItem宽/高 + getSize() { + return 100; + } + + // 设置FlowItem的宽/高数组 + setItemSizeArray() { + for (let i = 0; i < 100; i++) { + this.itemWidthArray.push(this.getSize()) + this.itemHeightArray.push(this.getSize()) + } + } + + aboutToAppear() { + this.setItemSizeArray(); + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + } + + @Builder + itemFoot() { + Column() { + Text(`Footer`) + .fontSize(10) + .backgroundColor(Color.Red) + .width(50) + .height(50) + .align(Alignment.Center) + .margin({ top: 2 }) + } + } + + build() { + Row() { + Column({ space: 10 }) { + WaterFlow({scroller:this.scroller}) { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Column() { + Text("N" + item).fontSize(12).height('16') + } + } + .onAppear(() => { + // 即将触底时提前增加数据 + if (item + 20 == this.dataSource.totalCount()) { + for (let i = 0; i < 100; i++) { + this.dataSource.addLastItem() + } + } + }) + .width('100%') + .height(this.itemHeightArray[item % 100]) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('50%') + .onReachStart(() => { + console.info('waterFlow reach start') + }) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset +' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0060_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0060_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('95%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0090.ets new file mode 100755 index 0000000000000000000000000000000000000000..564da42fb8c509600504adac609c49fbe1f900e1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0090.ets @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0090 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State dataArray: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + private scroller: Scroller = new Scroller() + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + @State alignListItem: ListItemAlign = ListItemAlign.Start + + aboutToAppear() { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + // 初始化数据源。 + for (let i = 0; i < 20; i++) { + this.dataArray.push(i) + } + } + + build() { + Column({space:10}) { + Row() { + List({ space: 20, initialIndex: 3, scroller: this.scroller }) { + ForEach(this.dataArray, (item: number) => { + ListItem() { + Text('Text:' + item) + .width(100) + .height('90%') + .backgroundColor('#FFabcd12') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + .borderWidth(1) + } + .borderRadius(10).backgroundColor(0xFFFFFF) + .width(100) + .height('90%') + }, (item: number) => JSON.stringify(item)) + } + .chainAnimation(true) + .edgeEffect(EdgeEffect.Spring) + .listDirection(Axis.Horizontal) + .height('50%') + .width('100%') + .scrollSnapAlign(ScrollSnapAlign.CENTER) + .borderRadius(10) + .backgroundColor(0x12aa45) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset +' }\n'; + }) + } + .width('100%') + .height('50%') + .padding({ top: 10 }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0090_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭' + } + }) + Button('scroll End').id('ScrollEventObserver0090_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.End); + }) + } + }.width('100%').height('100%').padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0100.ets new file mode 100755 index 0000000000000000000000000000000000000000..3009c5fa8b99458fea6e162bcd4928f1e8a48702 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0100.ets @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0100 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State dataArray: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + private scroller: ListScroller = new ListScroller() + @State listChildrenSize: ChildrenMainSize = new ChildrenMainSize(50) + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + aboutToAppear() { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info)+'\n'; + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + // 初始化数据源。 + for (let i = 0; i < 10; i++) { + this.dataArray.push(i) + } + // 前5个item的主轴大小不是默认大小100,因此需要通过ChildrenMainSize通知List。 + this.listChildrenSize.splice(0, 5, [300, 300, 300, 300, 300]) + } + + build() { + Row() { + Column({ space: 10 }) { + List({ space: 12, initialIndex: 0, scroller: this.scroller }) { + ForEach(this.dataArray, (item: number) => { + ListItem() { + Text('Text:' + item) + .width('90%') + .height(item < 5 ? 100 : this.listChildrenSize.childDefaultSize) + .backgroundColor('#FFabcd12') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + .borderWidth(1) + } + }, (item: number) => item.toString()) + } + .id('ScrollEventObserver0010') + .height('60%') + .width('100%') + .margin({ top: 12, left: '10%' }) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n'; + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes += ' ScrollStart开始了,UIObserver 关闭'; + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset + ' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0100_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'+'\n';; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0100_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('90%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0110.ets new file mode 100755 index 0000000000000000000000000000000000000000..9ab83fac66158ea887a47d2083aea60c2041243c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0110.ets @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2024 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 { WaterFlowDataSource } from './WaterFlowDataSource' + +@Entry +@Component +struct DFXScrollEventObserver0110 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + + @State minSize: number = 80 + @State maxSize: number = 180 + @State fontSize: number = 24 + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F] + scroller: Scroller = new Scroller() + dataSource: WaterFlowDataSource = new WaterFlowDataSource() + private itemWidthArray: number[] = [] + private itemHeightArray: number[] = [] + + // 计算FlowItem宽/高 + getSize() { + let ret = Math.floor(Math.random() * this.maxSize) + return 100; + } + + // 设置FlowItem的宽/高数组 + setItemSizeArray() { + for (let i = 0; i < 100; i++) { + this.itemWidthArray.push(this.getSize()) + this.itemHeightArray.push(this.getSize()) + } + } + + aboutToAppear() { + this.setItemSizeArray(); + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info)+'\n';; + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + } + + @Builder + itemFoot() { + Column() { + Text(`Footer`) + .fontSize(10) + .backgroundColor(Color.Red) + .width(50) + .height(50) + .align(Alignment.Center) + .margin({ top: 2 }) + } + } + + build() { + Row() { + Column({ space: 10 }) { + WaterFlow({scroller:this.scroller}) { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Column() { + Text("N" + item).fontSize(12).height('16') + } + } + .onAppear(() => { + // 即将触底时提前增加数据 + if (item + 20 == this.dataSource.totalCount()) { + for (let i = 0; i < 100; i++) { + this.dataSource.addLastItem() + } + } + }) + .width('100%') + .height(this.itemHeightArray[item % 100]) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('50%') + .onReachStart(() => { + console.info('waterFlow reach start') + }) + .onScrollFrameBegin((offset: number, state: ScrollState) => { + console.info('waterFlow scrollFrameBegin offset: ' + offset + ' state: ' + state.toString()) + return { offsetRemain: offset } + }) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n'; + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes += 'ScrollStart开始了,UIObserver又打开了, 信息是\n'+JSON.stringify(info); + }) + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ id=ScrollEventObserver0010 scrollOffset=' + scrollOffset + ' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0110_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'+'\n';; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0110_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('95%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0140.ets new file mode 100755 index 0000000000000000000000000000000000000000..04f766f3cdfcb490cd5a80b7f6c691b3e65ea32f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0140.ets @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2024 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 DFXScrollEventObserver0050 { + @State text: string = '这是一条很长的测试文本,This is a very long test text。' + @State isScrollNext: boolean = false + @State res: string = 'Scroll测试结果:\n' + @State startRes: string = '' + @State endRes: string = '' + @State scrollRes: string = '' + private scroller: Scroller = new Scroller() + @State isScrollListener: boolean = true; + @State observerRes: string = 'UIObserver结果:\n' + + aboutToAppear() { + if (this.isScrollListener) { + this.getUIContext().getUIObserver().on('scrollEvent', (info) => { + console.log('[Test] scrollEvent: ' + JSON.stringify(info)); + this.observerRes = JSON.stringify(info); + }) + } else { + console.log('[Test] scrollEvent: UIObserver off'); + } + } + + build() { + Row() { + Column({ space: 10 }) { + Scroll(this.scroller) { + Column({ space: 10 }) { + TextInput({ text: 'Text01' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text02' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text03' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text04' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text05' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text06' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text07' + this.text }).height(100).fontSize(20) + TextInput({ text: 'Text08' + this.text }).height(100).fontSize(20) + } + }.height(300).borderWidth(3) + .onScrollStart(() => { + this.startRes += 'onScrollStart回调咯\n' + }) + .onScrollStop(() => { + this.endRes += 'onScrollStop回调咯\n' + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + this.scrollRes = + 'onScroll回调,{ scrollOffset=' + scrollOffset + ' }\n'; + }) + + Text(this.startRes + this.endRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Text(this.observerRes) + .fontSize(20) + .fontColor(Color.Brown) + .width('90%') + .borderWidth(2) + .margin({ top: 10 }) + Row({ space: 10 }) { + Button('Observer Switch').id('ScrollEventObserver0140_btn1') + .onClick(() => { + this.isScrollListener = (this.isScrollListener) ? false : true; + if (!this.isScrollListener) { + this.getUIContext().getUIObserver().off('scrollEvent'); + this.observerRes = 'UIObserver 关闭'; + } + }) + Button('scroll Bottom').id('ScrollEventObserver0140_btn2') + .onClick(() => { + this.scroller.scrollEdge(Edge.Bottom); + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/WaterFlowDataSource.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/WaterFlowDataSource.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f3707233efd2cd24e372c9a8b3858357e8f6149 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/DFXScrollEventObserver/WaterFlowDataSource.ets @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2024 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. + */ + +// 实现IDataSource接口的对象,用于瀑布流组件加载数据 +export class WaterFlowDataSource implements IDataSource { + private dataArray: number[] = [] + private listeners: DataChangeListener[] = [] + + constructor() { + for (let i = 0; i < 100; i++) { + this.dataArray.push(i) + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index] + } + + // 通知控制器数据重新加载 + 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) + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener) + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener) + if (pos >= 0) { + this.listeners.splice(pos, 1) + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length) + this.notifyDataAdd(0) + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length) + this.notifyDataAdd(this.dataArray.length - 1) + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length) + this.notifyDataAdd(index) + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1) + this.notifyDataDelete(0) + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1) + this.notifyDataDelete(1) + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1) + this.notifyDataDelete(this.dataArray.length) + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1) + this.notifyDataDelete(index) + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1) + this.dataArray.splice(3, 2) + this.notifyDataReload() + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/SubAceStatusManagerDataDotting/SubAceStatusManagerDataDotting0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/SubAceStatusManagerDataDotting/SubAceStatusManagerDataDotting0010.ets new file mode 100755 index 0000000000000000000000000000000000000000..ef45ff99f86feaa0091073dbc65068f422cc881c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/SubAceStatusManagerDataDotting/SubAceStatusManagerDataDotting0010.ets @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 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 SubAceStatusManagerDataDotting0010 { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Image('blue_icon.png') + .width('100%') + .height(100) + .backgroundColor(Color.Blue) + } + }, (item: string) => item) + }.width('90%') + .id('list') + .scrollBar(BarState.Off) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationCustomTransitionInterface/UIAnimationCustomTransitionInterface0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationCustomTransitionInterface/UIAnimationCustomTransitionInterface0050.ets new file mode 100755 index 0000000000000000000000000000000000000000..b5b5c7725824ea821f08907278e7cbfeac3d28d9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationCustomTransitionInterface/UIAnimationCustomTransitionInterface0050.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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 UIAnimationCustomTransitionInterface0050 { + @State message: string = 'test change TextValue'; + + build() { + Column({ space: 10 }) { + Text(this.message) + .onClick(() => { + this.message = 'test change TextValue , test change TextValue'; + }).animation({ + duration: 2000, + curve: Curve.EaseOut, + iterations: 1, + }) + .id('UIAnimationCustomTransitionInterface0050_button_001') + + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0020.ets new file mode 100755 index 0000000000000000000000000000000000000000..23ae43c3fc8161d403351fa24145d4701b2b26c2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0020.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0020 { + build() { + Stack() { + Text('point & radius: 0') + .width(300).height(300).backgroundColor(Color.Black).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 0//圆点半径 + }, + count: 500, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 10, //每秒发射粒子数 + position: [0, 0], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0040.ets new file mode 100755 index 0000000000000000000000000000000000000000..b8dc36fffd19b8b700492b132d7d0d1da1431997 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0040.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0040 { + build() { + Stack() { + Text('point & radius: -10') + .width(300).height(300).backgroundColor(Color.Black).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: -10//圆点半径 + }, + count: 500, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + position: [0, 0], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0060.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f7da03e3530e4760f9dd62e2c28f06eeac26cef --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0060.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0060 { + build() { + Stack() { + Text('point & radius: undefined') + .width(300).height(300).backgroundColor(Color.Black).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: undefined//圆点半径 + }, + count: 500, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 10, //每秒发射粒子数 + position: [0, 0], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0090.ets new file mode 100755 index 0000000000000000000000000000000000000000..9e38a617549fdb7a1884087c6840a238cbbf77ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0090.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0090 { + build() { + Stack() { + Text('image & size: [-10, -10]') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.IMAGE, //粒子类型 + config: { + src: 'text_zheng.png', + size: [0, 0] + }, + count: 500, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 10, //每秒发射粒子数 + position: [-10, -10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0110.ets new file mode 100755 index 0000000000000000000000000000000000000000..dfe9ba01a3b81649d0f294a5fa486877e5519357 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0110.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0110 { + build() { + Stack() { + Text('image & size: [10, undefined]') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.IMAGE, //粒子类型 + config: { + src: 'text_zheng.png', + size: [10, undefined] + }, + count: 500, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 10, //每秒发射粒子数 + position: [-10, -10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0130.ets new file mode 100755 index 0000000000000000000000000000000000000000..30b5007563d309f3cdab663734b1dd53d32bd4f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0130.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0130 { + build() { + Stack() { + Text(' count = 0') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: 0, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + position: [-10, -10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0170.ets new file mode 100755 index 0000000000000000000000000000000000000000..cb03c778a6e264a4c1263552ad54adf79a3891c6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0170.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0170 { + build() { + Stack() { + Text('point & count: -2') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: -2, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 100, //每秒发射粒子数 + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0180.ets new file mode 100755 index 0000000000000000000000000000000000000000..5baf01945a4773b35395293938ac6a7f7cbb782a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0180.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0180 { + build() { + Stack() { + Text('point & count: -0.5') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: -0.5, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + emitRate: 100, //每秒发射粒子数 + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0190.ets new file mode 100755 index 0000000000000000000000000000000000000000..31df1cd770cedfbb4d15dec70bfc510ccfd22181 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0190.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0190 { + build() { + Stack() { + Text('count = null') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: null, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + position: [10, 10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0200.ets new file mode 100755 index 0000000000000000000000000000000000000000..029970634b1bb5279cb3e9217cdb616160fc39ed --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0200.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0200 { + build() { + Stack() { + Text('count = -0.5') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: -0.5, //粒子总数 + lifetime: 10000//粒子生命周期,单位ms + }, + position: [10, 10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0230.ets new file mode 100755 index 0000000000000000000000000000000000000000..3ecb645025d94097c508c39b9840de0d246eb8b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0230.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleOption0230 { + build() { + Stack() { + Text('count = 500 & lifetime = 0') + .width('100%').height('100%').backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.POINT, //粒子类型 + config: { + radius: 10 + }, + count: 500, //粒子总数 + lifetime: 0//粒子生命周期,单位ms + }, + position: [-10, -10], + shape: ParticleEmitterShape.RECTANGLE//发射器形状 + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleSpin/UIAnimationParticleSpin0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleSpin/UIAnimationParticleSpin0090.ets new file mode 100755 index 0000000000000000000000000000000000000000..7a423f4f5c512a8f979d6474f6912280b2939b00 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAnimationParticleSpin/UIAnimationParticleSpin0090.ets @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2024 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 UIAnimationParticleSpin0090 { + @State myCount: number = 100; + + build() { + Stack() { + Text('spin range: [0, 0] & config: [-20, 20]') + .width(300).height(300).backgroundColor(Color.Pink).fontColor(Color.Blue) + Particle({ + particles: [ + { + emitter: { + particle: { + type: ParticleType.IMAGE, + config: { + src:'text_zheng.png', + size: [20, 20] + }, + count: this.myCount, + lifetime: 10000 + }, + emitRate: 3, + shape: ParticleEmitterShape.CIRCLE + }, + spin: { + range: [0, 0], + updater: { + type: ParticleUpdater.RANDOM, + config: [-20, 20] + } + } + }] + }).width(300).height(300) + }.width("100%").height("100%").align(Alignment.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001.ets new file mode 100755 index 0000000000000000000000000000000000000000..532caaec708d6b942eaa1174b0a42e3a550787f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton001 { + build() { + Column() { + Button('One').margin({top:10}) + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Button('WithThemeTwo').margin({top:10}) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002.ets new file mode 100755 index 0000000000000000000000000000000000000000..e2be4c081aafa569695fb4ed97e571489d7835fa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002.ets @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2024 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 { CustomTheme, CustomColors } from '@kit.ArkUI'; +import uiAppearance from '@ohos.uiAppearance' + +class GreenColors implements CustomColors { + fontPrimary = '#ff049404'; + fontEmphasize = '#FF00541F'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#1111FF11'; + backgroundEmphasize = '#FF00541F'; + compEmphasizeSecondary = '#3322FF22'; +} + +class RedColors implements CustomColors { + fontPrimary = '#fff32b3c'; + fontEmphasize = '#FFD53032'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#44FF2222'; + backgroundEmphasize = '#FFD00000'; + compEmphasizeSecondary = '#33FF1111'; +} + +class YelloColors implements CustomColors { + fontPrimary = '#FFFF00'; + fontEmphasize = '#FFFF00'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#FFFF00'; + backgroundEmphasize = '#FFFF00'; + compEmphasizeSecondary = '#FFFF00'; +} + +class PinkColors implements CustomColors { + fontPrimary = '#FFB6C1'; + fontEmphasize = '#FFB6C1'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#FFB6C1'; + backgroundEmphasize = '#FFB6C1'; + compEmphasizeSecondary = '#FFB6C1'; +} + +class GreenColors_dark implements CustomColors { + fontPrimary = '#3330d630'; + fontEmphasize = '#3330d630'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#3330d630'; + backgroundEmphasize = '#3330d630'; + compEmphasizeSecondary = '#3330d630'; +} + +class RedColors_dark implements CustomColors { + fontPrimary = '#ff993941'; + fontEmphasize = '#ff993941'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#ff993941'; + backgroundEmphasize = '#ff993941'; + compEmphasizeSecondary = '#ff993941'; +} + +class YelloColors_dark implements CustomColors { + fontPrimary = '#ffeaea34'; + fontEmphasize = '#ffeaea34'; + fontOnPrimary = '#fffcfbfb'; + compBackgroundTertiary = '#ffeaea34'; + backgroundEmphasize = '#ffeaea34'; + compEmphasizeSecondary = '#ffeaea34'; +} + +class PinkColors_dark implements CustomColors { + fontPrimary = '#ffd64b60'; + fontEmphasize = '#ffde5166'; + fontOnPrimary = '#fffcfbfb'; + compBackgroundTertiary = '#ffbf4e5f'; + backgroundEmphasize = '#ffc8495c'; + compEmphasizeSecondary = '#FFB6C1'; +} + +class PageCustomTheme implements CustomTheme { + colors?: CustomColors; + + constructor(colors: CustomColors) { + this.colors = colors; + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceButton002 { + static readonly themeCount = 3; + @State themeIndex: number = 0; + themeArray: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new GreenColors()), + new PageCustomTheme(new RedColors()) + ]; + themeArray_dark: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new GreenColors_dark()), + new PageCustomTheme(new RedColors_dark()) + ]; + static readonly themeCount1 = 3; + @State themeIndex1: number = 0; + themeArray1: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new YelloColors()), + new PageCustomTheme(new PinkColors()) + ]; + themeArray1_dark: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new YelloColors_dark()), + new PageCustomTheme(new PinkColors_dark()) + ]; + + build() { + WithTheme({ theme: this.isDark() ? this.themeArray_dark[this.themeIndex1] : this.themeArray[this.themeIndex] }) { + Column() { + Button('One') + .margin('10px'); + WithTheme({ + theme: this.isDark() ? this.themeArray1_dark[this.themeIndex1] : this.themeArray1[this.themeIndex1] + }) { + Button('WithThemeTwo') + .margin('10px'); + } + + WithTheme({ + theme: this.isDark() ? this.themeArray1_dark[this.themeIndex1] : this.themeArray1[this.themeIndex1] + }) { + Button('WithThemeThree') + .margin('10px'); + } + + Button('Menu++').id('button_01') + .margin('10px') + .onClick(() => { + this.themeIndex = (1) % UIAttributeFontInterfaceButton002.themeCount; + }); + + Button('Menu--').id('button_02') + .margin('10px') + .onClick(() => { + this.themeIndex = (2) % UIAttributeFontInterfaceButton002.themeCount; + }); + + Button('Menu5++').id('button_03') + .margin('10px') + .onClick(() => { + this.themeIndex1 = (1) % UIAttributeFontInterfaceButton002.themeCount1; + }); + + Button('Menu5--').id('button_04') + .margin('10px') + .onClick(() => { + this.themeIndex1 = (2) % UIAttributeFontInterfaceButton002.themeCount1; + }); + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height("100%"); + } + } + + isDark(): boolean { + return uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK; + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003.ets new file mode 100755 index 0000000000000000000000000000000000000000..9f32d92478b8574e94ac3c8699cede6bd478832e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003.ets @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton003 { + build() { + Column() { + Button('One').margin({top:10}) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004.ets new file mode 100755 index 0000000000000000000000000000000000000000..0962d98716e28a67a93636f02fe90920a45d675f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton004 { + build() { + Column() { + Button('One').margin({top:10}) + WithTheme({ colorMode: ThemeColorMode.LIGHT}) { + Button('WithThemeTwo') + .margin({top:10}) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190.ets new file mode 100755 index 0000000000000000000000000000000000000000..9610d7a241a88cf158ee14aba2fef6466b4830ea --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton0190 { + build() { + Column() { + Button('One').margin({ top: 10 }) + WithTheme({ colorMode: null }) { + Button('WithThemeTwo') + .margin({ top: 10 }) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310.ets new file mode 100755 index 0000000000000000000000000000000000000000..63f27c0333ea4d3d375cbf871fd88580d739322f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton0310 { + build() { + Column() { + Button('One').margin({ top: 10 }) + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Button('WithThemeTwo') + .margin({ top: 10 }) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320.ets new file mode 100755 index 0000000000000000000000000000000000000000..75c31c23d0b271b3edadaa8ebfa50d26e7d6f8bd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceButton0320 { + build() { + Column() { + Button('One').margin({ top: 10 }) + WithTheme({ colorMode: undefined }) { + Button('WithThemeTwo') + .margin({ top: 10 }) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001.ets new file mode 100755 index 0000000000000000000000000000000000000000..51934aa5df127758029c795458f41b199e1b2080 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCanvas001 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + build(){ + Column() { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + WithTheme({ colorMode: ThemeColorMode.LIGHT}) { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + } + + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002.ets new file mode 100755 index 0000000000000000000000000000000000000000..4f5b3f2fdd3bd9e63c07b557f5541ab5f15329b8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCanvas002 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + build(){ + Column() { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + WithTheme({ colorMode: null}) { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + } + + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003.ets new file mode 100755 index 0000000000000000000000000000000000000000..20f21b8b7eb22aa8542801d5af4b9ffb347460a6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003.ets @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 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 uiAppearance from '@ohos.uiAppearance' + +@Entry +@Component +struct UIAttributeFontInterfaceCanvas003 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + build() { + Column() { + Canvas(this.context) + .width(100) + .height(100) + .margin({ top: 10 }) + .backgroundColor(this.isDark() ? '#ffffff' : '#ff0e0e0e') + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } + + isDark(): boolean { + return uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK; + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004.ets new file mode 100755 index 0000000000000000000000000000000000000000..0ebacb3358d82fb927aac5748a6243954b1cfb8a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCanvas004 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + build(){ + Column() { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + + + WithTheme({ colorMode: ThemeColorMode.DARK}) { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + } + + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005.ets new file mode 100755 index 0000000000000000000000000000000000000000..2cec2c37282d2a39eb56f8afeae538adc9daf8bb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCanvas005 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + build(){ + Column() { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + + + WithTheme({ colorMode: ThemeColorMode.SYSTEM}) { + Canvas(this.context) + .width(100) + .height(100) + .margin({top:10}) + .backgroundColor('#ffff00') + } + + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006.ets new file mode 100755 index 0000000000000000000000000000000000000000..797edc1f9434c5bb3d6ba014bdf42747f86d3609 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006.ets @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2024 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 { CustomTheme, CustomColors, uiAppearance } from '@kit.ArkUI'; + +class GreenColors_dark implements CustomColors { + fontPrimary = '#FFFFFFFF'; + fontEmphasize = '#FFFFFFFF'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#FFFFFFFF'; + backgroundEmphasize = '#FFFFFFFF'; + compEmphasizeSecondary = '#FFFFFFFF'; +} + +class RedColors_dark implements CustomColors { + fontPrimary = '#FFFFFFFF'; + fontEmphasize = '#FFFFFFFF'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#FFFFFFFF'; + backgroundEmphasize = '#FFFFFFFF'; + compEmphasizeSecondary = '#FFFFFFFF'; +} + +class GreenColors implements CustomColors { + fontPrimary = '#000000'; + fontEmphasize = '#000000'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#000000'; + backgroundEmphasize = '#000000'; + compEmphasizeSecondary = '#000000'; +} + +class RedColors implements CustomColors { + fontPrimary = '#000000'; + fontEmphasize = '#000000'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#000000'; + backgroundEmphasize = '#000000'; + compEmphasizeSecondary = '#000000'; +} + +class GreenColors1_dark implements CustomColors { + fontPrimary = '#ffc38d8d'; + fontEmphasize = '#ffc38d8d'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#ffc38d8d'; + backgroundEmphasize = '#ffc38d8d'; + compEmphasizeSecondary = '#ffc38d8d'; +} + +class RedColors1_dark implements CustomColors { + fontPrimary = '#ffd65a5a'; + fontEmphasize = '#ffd65a5a'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#ffd65a5a'; + backgroundEmphasize = '#ffd65a5a'; + compEmphasizeSecondary = '#ffd65a5a'; +} + +class GreenColors1 implements CustomColors { + fontPrimary = '#ff8d8b8b'; + fontEmphasize = '#ff8d8b8b'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#ff8d8b8b'; + backgroundEmphasize = '#ff8d8b8b'; + compEmphasizeSecondary = '#ff8d8b8b'; +} + +class RedColors1 implements CustomColors { + fontPrimary = '#ff373535'; + fontEmphasize = '#ff373535'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#ff373535'; + backgroundEmphasize = '#ff373535'; + compEmphasizeSecondary = '#ff373535'; +} + +class PageCustomTheme implements CustomTheme { + colors?: CustomColors + + constructor(colors: CustomColors) { + this.colors = colors + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceCanvas006 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + themeNames: string[] = ['System', 'Custom (green)', 'Custom (red)']; + themeArray: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors()), + new PageCustomTheme(new RedColors()), + ] + themeArray_dark: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors_dark()), + new PageCustomTheme(new RedColors_dark()), + ] + themeArray1: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors1()), + new PageCustomTheme(new RedColors1()), + ] + themeArray1_dark: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors1_dark()), + new PageCustomTheme(new RedColors1_dark()), + ] + @State themeIndex: number = 0; + @State themeIndex1: number = 0; + @State flag: boolean = false + + build() { + WithTheme({ theme: this.isDark() ? this.themeArray_dark[this.themeIndex] : this.themeArray[this.themeIndex] }) { + Column() { + Canvas(this.context) + .width(100) + .height(100) + .backgroundColor('#fff000') + .margin({ top: 10 }) + + WithTheme({ + theme: this.isDark() ? this.themeArray1_dark[this.themeIndex1] : this.themeArray1[this.themeIndex1] + }) { + Canvas(this.context) + .width(100) + .height(100) + .backgroundColor('#ff5c138a') + .margin({ top: 10 }) + } + + Button('Canvas4++') + .margin('10px') + .onClick(() => { + this.themeIndex1 = 0; + }).id('button_01'); + + Button('Canvas4--') + .margin('10px') + .onClick(() => { + this.themeIndex1 = 1; + }).id('button_02'); + + Button('Canvas5++') + .margin('10px') + .onClick(() => { + this.themeIndex1 = 0; + }).id('button_03'); + + Button('Canvas5--') + .margin('10px') + .onClick(() => { + this.themeIndex1 = 1; + }).id('button_04'); + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } + } + + isDark(): boolean { + return uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK; + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007.ets new file mode 100755 index 0000000000000000000000000000000000000000..9d08a4b0cbb8118da06352d9ef4c5c3c9409d12f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007.ets @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2024 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 { CustomTheme, CustomColors, uiAppearance } from '@kit.ArkUI'; + +class GreenColors_dark implements CustomColors { + fontPrimary = '#FFFFFFFF'; + fontEmphasize = '#FFFFFFFF'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#FFFFFFFF'; + backgroundEmphasize = '#FFFFFFFF'; + compEmphasizeSecondary = '#FFFFFFFF'; +} + +class RedColors_dark implements CustomColors { + fontPrimary = '#FFFFFFFF'; + fontEmphasize = '#FFFFFFFF'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#FFFFFFFF'; + backgroundEmphasize = '#FFFFFFFF'; + compEmphasizeSecondary = '#FFFFFFFF'; +} + +class GreenColors implements CustomColors { + fontPrimary = '#000000'; + fontEmphasize = '#000000'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#000000'; + backgroundEmphasize = '#000000'; + compEmphasizeSecondary = '#000000'; +} + +class RedColors implements CustomColors { + fontPrimary = '#000000'; + fontEmphasize = '#000000'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#000000'; + backgroundEmphasize = '#000000'; + compEmphasizeSecondary = '#000000'; +} + +class GreenColors1_dark implements CustomColors { + fontPrimary = '#ffc38d8d'; + fontEmphasize = '#ffc38d8d'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#ffc38d8d'; + backgroundEmphasize = '#ffc38d8d'; + compEmphasizeSecondary = '#ffc38d8d'; +} + +class RedColors1_dark implements CustomColors { + fontPrimary = '#ffd65a5a'; + fontEmphasize = '#ffd65a5a'; + fontOnPrimary = '#000000'; + compBackgroundTertiary = '#ffd65a5a'; + backgroundEmphasize = '#ffd65a5a'; + compEmphasizeSecondary = '#ffd65a5a'; +} + +class GreenColors1 implements CustomColors { + fontPrimary = '#ff8d8b8b'; + fontEmphasize = '#ff8d8b8b'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#ff8d8b8b'; + backgroundEmphasize = '#ff8d8b8b'; + compEmphasizeSecondary = '#ff8d8b8b'; +} + +class RedColors1 implements CustomColors { + fontPrimary = '#ff373535'; + fontEmphasize = '#ff373535'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#ff373535'; + backgroundEmphasize = '#ff373535'; + compEmphasizeSecondary = '#ff373535'; +} + +class PageCustomTheme implements CustomTheme { + colors?: CustomColors + + constructor(colors: CustomColors) { + this.colors = colors + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceCanvas007 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + themeNames: string[] = ['System', 'Custom (green)', 'Custom (red)']; + themeArray: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors()), + new PageCustomTheme(new RedColors()), + ] + themeArray_dark: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors_dark()), + new PageCustomTheme(new RedColors_dark()), + ] + themeArray1: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors1()), + new PageCustomTheme(new RedColors1()), + ] + themeArray1_dark: (CustomTheme)[] = [ + new PageCustomTheme(new GreenColors1_dark()), + new PageCustomTheme(new RedColors1_dark()), + ] + @State themeIndex: number = 0; + @State themeIndex1: number = 0; + @State flag: boolean = false + + build() { + WithTheme({}) { + Column() { + Canvas(this.context) + .width(100) + .height(100) + .backgroundColor('#fff000') + .margin({ top: 10 }) + + WithTheme({ + colorMode: undefined + }) { + Canvas(this.context) + .width(100) + .height(100) + .backgroundColor('#fffafafa') + .margin({ top: 10 }) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } + } + + isDark(): boolean { + return uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK; + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001.ets new file mode 100755 index 0000000000000000000000000000000000000000..48de2624ace122794bb5f669d0bebbc2cfc89a20 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle001 { + build() { + Column() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Circle({ width: 150, height: 150 }) + .margin({ top: 20 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002.ets new file mode 100755 index 0000000000000000000000000000000000000000..68664e0dce2e23fed8b0f2a61d5ef564cfe1d621 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle002 { + build() { + Column() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Circle({ width: 150, height: 150 }) + .margin({ top: 20 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003.ets new file mode 100755 index 0000000000000000000000000000000000000000..f523a739c8cdb5be2c3a9ae75b288500b634bdd6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle003 { + build() { + Column() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Circle({ width: 150, height: 150 }) + .margin({ top: 20 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004.ets new file mode 100755 index 0000000000000000000000000000000000000000..4ea35f49467f222ea29ed2e6234c5eb34f82a2fe --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle004 { + build() { + Column() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Circle({ width: 150, height: 150 }) + .margin({ top: 20 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005.ets new file mode 100755 index 0000000000000000000000000000000000000000..c6801d1c910391e9aac076a5573ce3ac78d2ffe8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005.ets @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle005 { + build() { + Column() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210.ets new file mode 100755 index 0000000000000000000000000000000000000000..3c875fb08e1d8969194cabb4d0b3c55ca02f67eb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle0210 { + private modeArr: number[] = [ThemeColorMode.LIGHT, ThemeColorMode.DARK, ThemeColorMode.SYSTEM]; + @State colorMode1: number = ThemeColorMode.LIGHT; + @State colorMode2: number = ThemeColorMode.LIGHT; + @State index1: number = 0; + @State index2: number = 0; + + build() { + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Button('one WithTheme3').margin(10) + Circle({ width: 50, height: 50 }) + .strokeWidth(3) + .stroke(Color.Red) + Circle({ width: 50, height: 50 }) + .margin({ top: 10 }) + .strokeWidth(3) + .stroke(Color.Yellow) + + WithTheme({ colorMode: this.colorMode2 }) { + Circle({ width: 50, height: 50 }) + .margin({ top: 10 }) + .strokeWidth(3) + .stroke(Color.Green) + } + + Button('Circle4++').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 < 2) { + this.index2++; + } + }).margin(5).id('button_0210_01') + Button('Circle4--').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 >= 1) { + this.index2--; + } + }).margin(5).id('button_0210_02') + Button('Circle5++').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 < 2) { + this.index1++; + } + }).margin(5).id('button_0210_03') + Button('Circle5--').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 >= 1) { + this.index1--; + } + }).id('button_0210_04') + + }.justifyContent(FlexAlign.Start).width('100%').height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270.ets new file mode 100755 index 0000000000000000000000000000000000000000..1ae0d076d7d4239a00568d4d5fa98b60c1820466 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle0270 { + build() { + Column() { + Circle({ width: 150, height: 150 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Circle({ width: 150, height: 150 }) + .margin({ top: 20 }) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001.ets new file mode 100755 index 0000000000000000000000000000000000000000..6f484beab10bda55adc22a57a91f9b7ffd3f8ef1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 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. + */ + +@CustomDialog +struct CustomDialogExample001 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} +@CustomDialog +struct CustomDialogExampley001 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + WithTheme({ colorMode: null }) { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .justifyContent(FlexAlign.Center) + .height(150) + .margin({top:10}).backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog001 { + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample001({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: false, + customStyle: false, + cornerRadius: 10, + }) + bialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExampley001({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: 50 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + this.bialogController = null + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.bialogController != null) { + this.bialogController.open() + } + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } + +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002.ets new file mode 100755 index 0000000000000000000000000000000000000000..af55fa3d25e8881809c3756f9617346e5cd3abbb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002.ets @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2024 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. + */ +@CustomDialog +struct CustomDialogExample002 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} +@CustomDialog +struct CustomDialogExampley002 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .justifyContent(FlexAlign.Center) + .height(150) + .margin({top:10}).backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog002 { + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample002({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + backgroundColor:Color.Black + }) + bialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExampley002({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: 50 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + this.bialogController = null + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.bialogController != null) { + this.bialogController.open() + } + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003.ets new file mode 100755 index 0000000000000000000000000000000000000000..77e6f4349179744a0dd903f8a7f5c2b96eeb62c8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003.ets @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2024 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. + */ +@CustomDialog +struct CustomDialogExample003 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} +@CustomDialog +struct CustomDialogExampley003 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .justifyContent(FlexAlign.Center) + .height(150) + .margin({top:10}).backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog003 { + @State flag: boolean = false + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample003({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + bialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExampley003({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: 50 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + this.bialogController = null + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.bialogController != null) { + this.bialogController.open() + } + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004.ets new file mode 100755 index 0000000000000000000000000000000000000000..697033ede297234fdb24fde4d50539c9c5aa0d89 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 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. + */ + +@CustomDialog +struct CustomDialogExample004 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} +@CustomDialog +struct CustomDialogExampley004 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .justifyContent(FlexAlign.Center) + .height(150) + .margin({top:10}).backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog004 { + @State flag: boolean = false + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample004({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + bialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExampley004({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: 50 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + backgroundColor:Color.White + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + this.bialogController = null + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.bialogController != null) { + this.bialogController.open() + } + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005.ets new file mode 100755 index 0000000000000000000000000000000000000000..7771d5467d65c471cd9410ede49f26ef2327d0b6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005.ets @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2024 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. + */ + + +@CustomDialog +struct CustomDialogExample0050_01 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 001') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@CustomDialog +struct CustomDialogExample0050_02 { + controller2?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 002') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@CustomDialog +struct CustomDialogExample0050_03 { + controller3?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 003') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog005 { + private modeArr: number[] = [ThemeColorMode.LIGHT, ThemeColorMode.DARK, ThemeColorMode.SYSTEM]; + @State colorMode1: number = ThemeColorMode.LIGHT; + @State colorMode2: number = ThemeColorMode.LIGHT; + @State index1: number = 0; + @State index2: number = 0; + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0050_01({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + dialogController1: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0050_02({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + dialogController2: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0050_03({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + + build() { + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Button('show Dialog01').onClick(() => { + this.dialogController?.open() + }) + Button('show Dialog02').onClick(() => { + this.dialogController1?.open() + }).margin(10) + + WithTheme({ colorMode: this.colorMode2 }) { + Button('show Dialog03').onClick(() => { + this.dialogController2?.open() + }) + } + + Button('CustomDialog4++').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 < 2) { + this.index2++; + } + }).margin(5).id('button_0050_01').backgroundColor(Color.Orange) + Button('CustomDialog4--').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 >= 1) { + this.index2--; + } + }).margin(5).id('button_0050_02').backgroundColor(Color.Orange) + Button('CustomDialog5++').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 < 2) { + this.index1++; + } + }).margin(5).id('button_0050_03').backgroundColor(Color.Orange) + Button('CustomDialog5--').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 >= 1) { + this.index1--; + } + }).id('button_0050_04').backgroundColor(Color.Orange) + + }.justifyContent(FlexAlign.Start).width('100%').height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006.ets new file mode 100755 index 0000000000000000000000000000000000000000..4374adbb063371983f2f456da9f51783851c12f8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006.ets @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2024 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. + */ + +@CustomDialog +struct CustomDialogExample006 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} +@CustomDialog +struct CustomDialogExampley006 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + WithTheme({ colorMode: undefined }) { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .justifyContent(FlexAlign.Center) + .height(150) + .margin({top:10}).backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog006 { + @State flag: boolean = false + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample006({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + bialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExampley006({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: 50 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + this.bialogController = null + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.bialogController != null) { + this.bialogController.open() + } + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007.ets new file mode 100755 index 0000000000000000000000000000000000000000..8b77f8c414bae3d341de904201aa3bce48d317f5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007.ets @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2024 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. + */ + +@CustomDialog +struct CustomDialogExample007 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column() { + Text('可展示在主窗口外的弹窗') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@Entry +@Component + +struct UIAttributeFontInterfaceCustomDialog007 { + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample007({ + cancel: ()=> { this.onCancel() }, + confirm: ()=> { this.onAccept() } + }), + cancel: this.existApp, + autoCancel: true, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + }, + offset: { dx: 0, dy: -150 }, + gridCount: 4, + showInSubWindow: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + // 在自定义组件即将析构销毁时将dialogController置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + } + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + existApp() { + console.info('Click the callback in the blank area') + } + + build() { + Column() { + Button('Button').id('1') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }) + }.width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog0330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog0330.ets new file mode 100755 index 0000000000000000000000000000000000000000..f6717fb139dc365d43215e9232fc6231cd49d5ee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog0330.ets @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2024 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. + */ + + +@CustomDialog +struct CustomDialogExample0330_01 { + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 001') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@CustomDialog +struct CustomDialogExample0330_02 { + controller2?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 002') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@CustomDialog +struct CustomDialogExample0330_03 { + controller3?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('custom 003') + .fontSize(30) + .height(100) + .width('100%') + } + .height(150) + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceCustomDialog0330 { + private modeArr: number[] = [ThemeColorMode.LIGHT, ThemeColorMode.DARK, ThemeColorMode.SYSTEM]; + @State colorMode1: number = ThemeColorMode.LIGHT; + @State colorMode2: number = ThemeColorMode.LIGHT; + @State index1: number = 0; + @State index2: number = 0; + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0330_01({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + dialogController1: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0330_02({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + dialogController2: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample0330_03({}), + autoCancel: true, + isModal: true, + customStyle: false, + cornerRadius: 10, + }) + + build() { + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Button('show Dialog01').onClick(() => { + this.dialogController?.open() + }) + Button('show Dialog02').onClick(() => { + this.dialogController1?.open() + }).margin(10) + + WithTheme({ colorMode: this.colorMode2 }) { + Button('show Dialog03').onClick(() => { + this.dialogController2?.open() + }) + } + + Button('CustomDialog4++').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 < 2) { + this.index2++; + } + }).margin(5).id('button_0330_01').backgroundColor(Color.Orange) + Button('CustomDialog4--').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 >= 1) { + this.index2--; + } + }).margin(5).id('button_0330_02').backgroundColor(Color.Orange) + Button('CustomDialog5++').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 < 2) { + this.index1++; + } + }).margin(5).id('button_0330_03').backgroundColor(Color.Orange) + Button('CustomDialog5--').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 >= 1) { + this.index1--; + } + }).id('button_0330_04').backgroundColor(Color.Orange) + + }.justifyContent(FlexAlign.Start).width('100%').height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0040.ets new file mode 100755 index 0000000000000000000000000000000000000000..cb98244a796f05142d34f313286b60737d2ac2ab --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0040.ets @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 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 { ComposeTitleBar, promptAction } from '@kit.ArkUI' + +@Entry +@Component +struct UIAttributeFontInterfaceDarkMode0040 { + build() { + Row() { + Column() { + ComposeTitleBar({ + menuItems: [{ isEnabled: true, value: 'other_icon.png', + action: () => promptAction.showToast({ message: "show toast index 1" }) + }], + title: "标题", + subtitle: "副标题" + }) + Divider().height(2).color(0xCCCCCC).id('divider_0040') + }.width('100%') + }.width('100%').justifyContent(FlexAlign.Start) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0050.ets new file mode 100755 index 0000000000000000000000000000000000000000..9477060f5857cb31e1f35c126a6be7738ea8b9c2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0050.ets @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 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 { ComposeTitleBar, promptAction } from '@kit.ArkUI' + +@Entry +@Component +struct UIAttributeFontInterfaceDarkMode0050 { + build() { + Row() { + Column() { + ComposeTitleBar({ + menuItems: [{ isEnabled: true, value: 'close_icon.png', + action: () => promptAction.showToast({ message: "show toast index 1" }) + }], + title: "标题", + subtitle: "副标题", + item: { isEnabled: true, value: $r('app.media.app_icon') } + }) + Divider().height(2).color(0xCCCCCC) + }.width('100%') + }.width('100%').justifyContent(FlexAlign.Start) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001.ets new file mode 100755 index 0000000000000000000000000000000000000000..16ebf9f320bea7ff2b8e79de42fa76fc02a69dfc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; + +@Entry +@Component +struct UIAttributeFontInterfaceImage001 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + + build() { + Column() { + Column() { + Image(this.image) + .width(100) + .height(100) + .margin(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Image(this.image) + .width(100) + .height(100) + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002.ets new file mode 100755 index 0000000000000000000000000000000000000000..5b6ec48995ffceec502b4df14772d7eb91a470b9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; + +@Entry +@Component +struct UIAttributeFontInterfaceImage002 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + + build() { + Column() { + Column() { + Image(this.image) + .width(100) + .height(100) + .margin(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Image(this.image) + .width(100) + .height(100) + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003.ets new file mode 100755 index 0000000000000000000000000000000000000000..8e623228e14a4f365c71ec8b12709143bd5724e7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; + +@Entry +@Component +struct UIAttributeFontInterfaceImage003 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + + build() { + Column() { + Column() { + Image(this.image) + .width(100) + .height(100) + .margin(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Image(this.image) + .width(100) + .height(100) + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004.ets new file mode 100755 index 0000000000000000000000000000000000000000..3d88c46fde5241bdb2447ff8f99a07b3dc249807 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; + +@Entry +@Component +struct UIAttributeFontInterfaceImage004 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + + build() { + Column() { + Column() { + Image(this.image) + .width(100) + .height(100) + .margin(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Image(this.image) + .width(100) + .height(100) + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005.ets new file mode 100755 index 0000000000000000000000000000000000000000..72a968bd387f51a2d933096a155f4008b592af87 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; + +@Entry +@Component +struct UIAttributeFontInterfaceImage005 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + + build() { + Column() { + Row() { + Image(this.image) + .width(100) + .height(100) + .margin({ right: 20 }) + } + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006.ets new file mode 100755 index 0000000000000000000000000000000000000000..bfd752047c550409260691ae94838dba9f51875a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 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 { image } from '@kit.ImageKit'; +import { buffer } from '@kit.ArkTS'; +@Entry +@Component +struct UIAttributeFontInterfaceImage006 { + @State image: string | null = null; + @State draggable1: boolean = true; + @State dragPreviewOptions1: DragPreviewOptions | null = null; + @State AVisible: Visibility = Visibility.Visible + + private async getPixmapFromMedia(resource: Resource) { + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ + bundleName: resource.bundleName, + moduleName: resource.moduleName, + id: resource.id + }) + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)) + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ + desiredPixelFormat: image.PixelMapFormat.RGBA_8888 + }) + await imageSource.release() + return createPixelMap + } + async getBase64() { + let pixelMap = await this.getPixmapFromMedia($r('app.media.caiyuan')) + const imagePackerApi: image.ImagePacker = image.createImagePacker(); + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 }; + imagePackerApi.packing(pixelMap, packOpts).then((data: ArrayBuffer) => { + let buf: buffer.Buffer = buffer.from(data); + this.image = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length); + }) + } + + aboutToAppear(): void { + this.getBase64(); + } + build(){ + Column() { + Column() { + Image(this.image) + .width(100) + .height(100) + .margin(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Image(this.image) + .width(100) + .height(100) + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220.ets new file mode 100755 index 0000000000000000000000000000000000000000..7502086dcbde22d6d27e01e2822fa71c8c81830c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceCircle0220 { + private modeArr: number[] = [ThemeColorMode.LIGHT, ThemeColorMode.DARK, ThemeColorMode.SYSTEM]; + @State colorMode1: number = ThemeColorMode.LIGHT; + @State colorMode2: number = ThemeColorMode.LIGHT; + @State index1: number = 0; + @State index2: number = 0; + + build() { + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Image('2.png') + .width(100) + .height(100) + .margin({ top: 10 }) + Image('img.png') + .width(100) + .height(100) + .margin({ top: 10 }) + + WithTheme({ colorMode: this.colorMode2 }) { + Image('cat.jpg') + .width(100) + .height(100) + .margin({ top: 10 }) + } + + Button('Image4++').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 < 2) { + this.index2++; + } + }).margin(5).id('button_0220_01') + Button('Image4--').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 >= 1) { + this.index2--; + } + }).margin(5).id('button_0220_02') + Button('Image5++').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 < 2) { + this.index1++; + } + }).margin(5).id('button_0220_03') + Button('Image5--').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 >= 1) { + this.index1--; + } + }).id('button_0220_04') + + }.justifyContent(FlexAlign.Start).width('100%').height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001.ets new file mode 100755 index 0000000000000000000000000000000000000000..195de68b58739c792f7b248cf51eba88844087eb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001.ets @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2024 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 { CustomTheme, CustomColors, SymbolGlyphModifier } from '@kit.ArkUI'; + +class GreenColors implements CustomColors { + fontPrimary = '#ff049404'; + fontEmphasize = '#FF00541F'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#1111FF11'; + backgroundEmphasize = '#FF00541F'; + compEmphasizeSecondary = '#3322FF22'; +} + +class RedColors implements CustomColors { + fontPrimary = '#fff32b3c'; + fontEmphasize = '#FFD53032'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#44FF2222'; + backgroundEmphasize = '#FFD00000'; + compEmphasizeSecondary = '#33FF1111'; +} + +class YelloColors implements CustomColors { + fontPrimary = '#FFFF00'; + fontEmphasize = '#FFFF00'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#FFFF00'; + backgroundEmphasize = '#FFFF00'; + compEmphasizeSecondary = '#FFFF00'; +} + +class PinkColors implements CustomColors { + fontPrimary = '#FFB6C1'; + fontEmphasize = '#FFB6C1'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#FFB6C1'; + backgroundEmphasize = '#FFB6C1'; + compEmphasizeSecondary = '#FFB6C1'; +} + +class PageCustomTheme implements CustomTheme { + colors?: CustomColors; + + constructor(colors: CustomColors) { + this.colors = colors; + } +} + +@Entry +@Component +struct UIAttributeFontInterfaceMenu001 { + @State micIconModifier: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_mic')).fontSize('24vp'); + @State trashIconModifier: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_trash')).fontSize('24vp'); + static readonly themeCount = 3; + @State themeIndex: number = 0; + themeArray: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new GreenColors()), + new PageCustomTheme(new RedColors()) + ]; + static readonly themeCount1 = 3; + @State themeIndex1: number = 0; + themeArray1: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new YelloColors()), + new PageCustomTheme(new PinkColors()) + ]; + static readonly themeCount0 = 3; + @State themeIndex0: number = 0; + themeArray0: (CustomTheme | undefined)[] = [ + undefined, // System + new PageCustomTheme(new PinkColors()), + new PageCustomTheme(new GreenColors()) + ]; + + @Builder + SubMenu() { + WithTheme({ theme: this.themeArray1[this.themeIndex1] }) { + Column() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + }.justifyContent(FlexAlign.Center) + .width('60%') + .backgroundColor($r('sys.color.background_primary')) + } + } + + @Builder + MyMenu() { + WithTheme({ theme: this.themeArray[this.themeIndex] }) { + Column() { + Menu() { + MenuItem({ symbolStartIcon: this.micIconModifier, content: "菜单选项" }) + .enabled(false) + MenuItem({ + symbolStartIcon: this.trashIconModifier, + content: "show WithThemeThree", + builder: (): void => this.SubMenu(), + }) + } + }.justifyContent(FlexAlign.Center) + .width('60%') + .backgroundColor($r('sys.color.background_primary')) + } + } + + build() { + WithTheme({ theme: this.themeArray0[this.themeIndex0] }) { + Column() { + Menu() { + MenuItem({ content: "Menu One" }); + } + .margin('10px'); + + Column() { + Text('click to show WithThemeTwo').id('menu0010_text') + .fontSize(20) + .fontWeight(FontWeight.Bold).borderWidth(5) + } + .bindMenu(this.MyMenu).margin(20) + + Button('Menu++').id('1').fontSize(18) + .margin('10px') + .onClick(() => { + this.themeIndex = (1) % UIAttributeFontInterfaceMenu001.themeCount; + }); + + Button('Menu--').id('2').fontSize(18) + .margin('10px') + .onClick(() => { + this.themeIndex = (2) % UIAttributeFontInterfaceMenu001.themeCount; + }); + + Button('Menu5++').id('3').fontSize(18) + .margin('10px') + .onClick(() => { + this.themeIndex1 = (1) % UIAttributeFontInterfaceMenu001.themeCount1; + }); + + Button('Menu5--').id('4').fontSize(18) + .margin('10px') + .onClick(() => { + this.themeIndex1 = (2) % UIAttributeFontInterfaceMenu001.themeCount1; + }); + }.margin(20) + .width('100%') + .height("100%"); + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002.ets new file mode 100755 index 0000000000000000000000000000000000000000..15d67d7aaf1d91854d4ebc7bdfe5817b311ab14c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu002 { + build() { + Column() { + Menu() { + MenuItem({ content: "Menu" }); + } + .margin({ bottom: 10, left: 50 }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003.ets new file mode 100755 index 0000000000000000000000000000000000000000..38d46b37b8febc1f5e6a6939d4216de224428c01 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu003 { + build() { + Column() { + Column() { + Menu() { + MenuItem({ content: "菜单选项1" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Menu() { + MenuItem({ content: "菜单选项2" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004.ets new file mode 100755 index 0000000000000000000000000000000000000000..3f82cd578880619eec069021140eeed83d392b62 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu004 { + build() { + Column() { + Column() { + Menu() { + MenuItem({ content: "菜单选项1" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Menu() { + MenuItem({ content: "菜单选项2" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005.ets new file mode 100755 index 0000000000000000000000000000000000000000..47b4af1c5cdbeb68ea0cc7257e34f275d3230d7c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu005 { + build() { + Column() { + Column() { + Menu() { + MenuItem({ content: "菜单选项1" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Menu() { + MenuItem({ content: "菜单选项2" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006.ets new file mode 100755 index 0000000000000000000000000000000000000000..e56fea97a2520692cce76214568a21a97b9c95ae --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu006 { + build() { + Column() { + Column() { + Menu() { + MenuItem({ content: "菜单选项1" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Menu() { + MenuItem({ content: "菜单选项2" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007.ets new file mode 100755 index 0000000000000000000000000000000000000000..d799dcb688d0243dd44320ac266dd11761780051 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceMenu007 { + build() { + Column() { + Column() { + Menu() { + MenuItem({ content: "菜单选项1" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Menu() { + MenuItem({ content: "菜单选项2" }); + } + .margin({ bottom: 10 }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001.ets new file mode 100755 index 0000000000000000000000000000000000000000..6f4c2e353ec26df7729da7f11a14213f3e790e36 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup001 { + build() { + Column() { + Column() { + // popup 自定义高级组件 + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002.ets new file mode 100755 index 0000000000000000000000000000000000000000..d5dd32b20dfd1f81c05d1bc4d01a3d364f7c3f07 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002.ets @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup002 { + build() { + Column() { + Popup({ + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + } + .justifyContent(FlexAlign.Center).width("100%").height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003.ets new file mode 100755 index 0000000000000000000000000000000000000000..7fa4b3682e9f0db4db4fb173bdbecce6a8d66907 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup003 { + build() { + Column() { + Column() { + // popup 自定义高级组件 + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004.ets new file mode 100755 index 0000000000000000000000000000000000000000..3cc956f6809d71eb64222113d81651a93cd90e74 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup004 { + build() { + Column() { + Column() { + // popup 自定义高级组件 + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup005.ets new file mode 100755 index 0000000000000000000000000000000000000000..79d8039a81807488e339d6447b10d126d49b0db6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup005.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup005 { + build() { + Column() { + Column() { + // popup 自定义高级组件 + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006.ets new file mode 100755 index 0000000000000000000000000000000000000000..65ce7e2585bf4d7c695c8a55950d26e58a3315b5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; + +@Entry +@Component +struct UIAttributeFontInterfacePopup006 { + build() { + Column() { + Column() { + // popup 自定义高级组件 + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Popup({ + // PopupTextOptions 类型设置文字内容 + title: { + text: 'This is a popup with PopupOptions', + fontSize: 25, + fontWeight: FontWeight.Normal + } as PopupTextOptions, + //PopupTextOptions 类型设置文字内容 + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007.ets new file mode 100755 index 0000000000000000000000000000000000000000..d2a61c949662242ba8b145501c35714402d01abf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007.ets @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2024 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 { Popup, PopupTextOptions, PopupButtonOptions, PopupIconOptions } from '@kit.ArkUI'; +import { CustomTheme, CustomColors } from '@kit.ArkUI'; + +class GreenColors implements CustomColors { + fontPrimary = '#ff049404'; + fontEmphasize = '#FF00541F'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#1111FF11'; + backgroundEmphasize = '#FF00541F'; + compEmphasizeSecondary = '#3322FF22'; +} + +class RedColors implements CustomColors { + fontPrimary = '#fff32b3c'; + fontEmphasize = '#FFD53032'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#44FF2222'; + backgroundEmphasize = '#FFD00000'; + compEmphasizeSecondary = '#33FF1111'; +} + +class YelloColors implements CustomColors { + fontPrimary = '#FFFF00'; + fontEmphasize = '#FFFF00'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#FFFF00'; + backgroundEmphasize = '#FFFF00'; + compEmphasizeSecondary = '#FFFF00'; +} + +class BlueColors implements CustomColors { + fontPrimary = '#0000FF'; + fontEmphasize = '#0000FF'; + fontOnPrimary = '#FFFFFFFF'; + compBackgroundTertiary = '#0000FF'; + backgroundEmphasize = '#0000FF'; + compEmphasizeSecondary = '#0000FF'; +} + +class PageCustomTheme implements CustomTheme { + colors?: CustomColors; + + constructor(colors: CustomColors) { + this.colors = colors; + } +} + +@Entry +@Component +struct UIAttributeFontInterfacePopup007 { + static readonly themeCount = 3; + @State themeIndex: number = 0; + themeArray: (CustomTheme | undefined)[] = [ + undefined, + new PageCustomTheme(new GreenColors()), + new PageCustomTheme(new RedColors()) + ]; + static readonly themeCount1 = 3; + @State themeIndex1: number = 0; + themeArray1: (CustomTheme | undefined)[] = [ + undefined, + new PageCustomTheme(new YelloColors()), + new PageCustomTheme(new BlueColors()) + ]; + + build() { + Column() { + Popup({ + message: { + text: 'This is the message', + fontSize: 25, + } as PopupTextOptions, + }) + WithTheme({ theme: this.themeArray[this.themeIndex] }) { + Column({ space: 10 }) { + Popup({ + message: { + text: 'This is the WithTheme2', + fontSize: 25, + } as PopupTextOptions, + }) + WithTheme({ theme: this.themeArray1[this.themeIndex1] }) { + Popup({ + message: { + text: 'This is the WithTheme3', + fontSize: 25, + } as PopupTextOptions, + }) + } + + }.justifyContent(FlexAlign.Center).width("100%").height("40%") + } + + Button('Popup4++').id('1') + .margin('10px') + .onClick(() => { + this.themeIndex = (1) % UIAttributeFontInterfacePopup007.themeCount; + }); + Button('Popup4--').id('2') + .margin('10px') + .onClick(() => { + this.themeIndex = (2) % UIAttributeFontInterfacePopup007.themeCount; + }); + Button('Popup5++').id('3') + .margin('10px') + .onClick(() => { + this.themeIndex1 = (1) % UIAttributeFontInterfacePopup007.themeCount1; + }); + Button('Popup5--').id('4') + .margin('10px') + .onClick(() => { + this.themeIndex1 = (2) % UIAttributeFontInterfacePopup007.themeCount1; + }); + }.justifyContent(FlexAlign.Center).width("100%").height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001.ets new file mode 100755 index 0000000000000000000000000000000000000000..713f062cd257a783e6e0e299fc7c8d5ce3a104ba --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider001 { + @State outSetValueOne: number = 40 + + build() { + Column() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002.ets new file mode 100755 index 0000000000000000000000000000000000000000..7c2a9b655aebdcdc342a9e77003678d393206d24 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider002 { + @State outSetValueOne: number = 40 + build(){ + Column(){ + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + WithTheme({ colorMode:null}) { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + } + }.justifyContent(FlexAlign.Center).width("100%").height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003.ets new file mode 100755 index 0000000000000000000000000000000000000000..4b01c15388857fd41be2c2079651c9d941728f2c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider003 { + @State outSetValueOne: number = 40 + build(){ + Column() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004.ets new file mode 100755 index 0000000000000000000000000000000000000000..762d699b2b4b41e3dd3b7fb56424f542f6134220 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004.ets @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider004 { + @State outSetValueOne: number = 40 + build(){ + Column(){ + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center).width("100%").height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005.ets new file mode 100755 index 0000000000000000000000000000000000000000..68ddc0632235aa028c602144cd84d112938a94cb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider005 { + @State outSetValueOne: number = 40 + build(){ + Column() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006.ets new file mode 100755 index 0000000000000000000000000000000000000000..b804b2f82bd63387ed79003a4a227aeeeddce6eb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider006 { + @State outSetValueOne: number = 40 + build(){ + Column() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007.ets new file mode 100755 index 0000000000000000000000000000000000000000..0eb47add2fb1296315489320f13d9c57c22d7785 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider007 { + @State outSetValueOne: number = 40 + build(){ + Column() { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Slider({ + value: this.outSetValueOne, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .showTips(true) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180.ets new file mode 100755 index 0000000000000000000000000000000000000000..448fd4492f428f3ac32a499f2f6b819241340f50 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180.ets @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceSlider0180 { + private modeArr: number[] = [ThemeColorMode.LIGHT, ThemeColorMode.DARK, ThemeColorMode.SYSTEM]; + @State colorMode1: number = ThemeColorMode.LIGHT; + @State colorMode2: number = ThemeColorMode.LIGHT; + @State index1: number = 0; + @State index2: number = 0; + + build() { + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Slider({ + min: 0, + max: 100, + value: 60, + style: SliderStyle.OutSet + }).showTips(true).margin(10) + Slider({ + min: 0, + max: 100, + value: 40, + style: SliderStyle.OutSet + }).showTips(true) + + WithTheme({ colorMode: this.colorMode2 }) { + Slider({ + min: 0, + max: 100, + value: 20, + style: SliderStyle.OutSet + }).showTips(true) + } + + Button('Slider4++').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 < 2) { + this.index2++; + } + }).margin(5).id('button_0180_01') + Button('Slider4--').onClick(() => { + this.colorMode2 = this.modeArr[this.index2]; + if (this.index2 >= 1) { + this.index2--; + } + }).margin(5).id('button_0180_02') + Button('Slider5++').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 < 2) { + this.index1++; + } + }).margin(5).id('button_0180_03') + Button('Slider5--').onClick(() => { + this.colorMode1 = this.modeArr[this.index1]; + if (this.index1 >= 1) { + this.index1--; + } + }).id('button_0180_04') + + }.justifyContent(FlexAlign.Start).width('100%').height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001.ets new file mode 100755 index 0000000000000000000000000000000000000000..ed489892516971abbe1608d6b7566cdbd84e944a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText001 { + build(){ + Column() { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002.ets new file mode 100755 index 0000000000000000000000000000000000000000..dfb61646e8fe4bb4b072c4dfae207a88b5e125fb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002.ets @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText002 { + build(){ + Column(){ + Row() { + Text('textAlign').fontSize(20) + } + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003.ets new file mode 100755 index 0000000000000000000000000000000000000000..5dd176a0674aec5a7b007679d346bd56610da2eb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText003 { + build(){ + Column() { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004.ets new file mode 100755 index 0000000000000000000000000000000000000000..41be56103b696e025abf9e88f35fb465c8900cfc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText004 { + @State colorMode1:ThemeColorMode | undefined = undefined; + @State colorMode2:ThemeColorMode | undefined = undefined; + + build(){ + Column({space:10}) { + Column() { + Text('Text1').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('20%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Text('Text2').fontSize(35) + WithTheme({ colorMode: this.colorMode2 }) { + Column() { + Text('Text3').fontSize(25) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('20%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('50%').backgroundColor($r('sys.color.background_primary')) + } + + Button('Text4++').id('btn1').onClick(()=>{ + this.colorMode1 = ThemeColorMode.LIGHT; + }) + Button('Text4--').id('btn2').onClick(()=>{ + this.colorMode1 = ThemeColorMode.DARK; + }) + Button('Text5++').id('btn3').onClick(()=>{ + this.colorMode2 = ThemeColorMode.LIGHT; + }) + Button('Text5--').id('btn4').onClick(()=>{ + this.colorMode2 = ThemeColorMode.DARK; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005.ets new file mode 100755 index 0000000000000000000000000000000000000000..66239593972755f279d5b3f9a3bc3dcc8b5563e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText005 { + build(){ + Column() { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Text('textAlign').fontSize(20) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140.ets new file mode 100755 index 0000000000000000000000000000000000000000..f1f36828a99a40ad2b9ccf4dd5a932e7d1e68aa3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText0140 { + build() { + Column() { + Text('This test text not in WithTheme').margin({ top: 10 }) + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Text('This test text in WithThemeTwo') + .margin({ top: 10 }) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200.ets new file mode 100755 index 0000000000000000000000000000000000000000..1e15bee733a64e0a5191884bc2247b0bfed29fa8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceText0200 { + build() { + Column() { + Text('This test text not in WithTheme').margin({ top: 10 }) + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Text('This test text in WithThemeTwo') + .margin({ top: 10 }) + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001.ets new file mode 100755 index 0000000000000000000000000000000000000000..4166704c03ff8b214f796cc0d82f754e30ebe59f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo001 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.SYSTEM }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002.ets new file mode 100755 index 0000000000000000000000000000000000000000..c32a36a93c20ccbb1cc87c6cb68e1e67665d9fd5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo002 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: null }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003.ets new file mode 100755 index 0000000000000000000000000000000000000000..961241244295889c7a28956de75b3db7e913501a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo003 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004.ets new file mode 100755 index 0000000000000000000000000000000000000000..0440d9724623e309dfc612af791420d167dd0dd8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo004 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: undefined }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005.ets new file mode 100755 index 0000000000000000000000000000000000000000..74ffabdcbcddc566b56a23f7965a1cabb70f403d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo005 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.LIGHT }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006.ets new file mode 100755 index 0000000000000000000000000000000000000000..a162b10dfc73a497139b9a1d07890ff2ceb03fe4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo006 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build(){ + Column() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: ThemeColorMode.DARK }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(200) + .margin({top:50}) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('40%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007.ets new file mode 100755 index 0000000000000000000000000000000000000000..3818a93378266a00eefcdf8f79358e6705feb000 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007.ets @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2024 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 UIAttributeFontInterfaceVideo007 { + @State videoSrc: Resource = $rawfile('video1.ts') + @State previewUri: Resource = $r('app.media.caiyuan') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + @State colorMode1: ThemeColorMode | undefined = undefined; + @State colorMode2: ThemeColorMode | undefined = undefined; + + build() { + Column({ space: 10 }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(100) + .margin({ top: 50 }) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('20%').backgroundColor($r('sys.color.background_primary')) + + WithTheme({ colorMode: this.colorMode1 }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(100) + .margin({ top: 50 }) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + WithTheme({ colorMode: this.colorMode2 }) { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }) + .width('60%') + .height(100) + .margin({ top: 50 }) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('20%').backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center) + .width('100%') + .height('50%').backgroundColor($r('sys.color.background_primary')) + } + + Button('video4++').id('btn1').onClick(() => { + this.colorMode1 = ThemeColorMode.LIGHT; + }) + Button('video4--').id('btn2').onClick(() => { + this.colorMode1 = ThemeColorMode.DARK; + }) + Button('video5++').id('btn3').onClick(() => { + this.colorMode2 = ThemeColorMode.LIGHT; + }) + Button('video5--').id('btn4').onClick(() => { + this.colorMode2 = ThemeColorMode.DARK; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0230.ets new file mode 100755 index 0000000000000000000000000000000000000000..1d73f031db60a3206203444fbcf8cb416ab79b8f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0230.ets @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0230 { + @State msg: string = ''; + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + confirm: { + defaultFocus: true, + value: 'ConfirmButton', + action: () => { + this.msg = 'Confirm is done'; + } + }, + sheets: [ + { + title: 'apple', + icon: 'cat.jpg', + action: () => { + } + } + ] + }) + }) + Text(this.msg) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0270.ets new file mode 100755 index 0000000000000000000000000000000000000000..f2abb26bef27329cf3a9730fbbc1d74f7c71e40b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0270.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0270 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + sheets: [ + { + title: getContext().resourceManager.getStringSync($r('app.string.span')), + action: () => { + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280.ets new file mode 100755 index 0000000000000000000000000000000000000000..d0c4a6c5b40c2f9b2fd1a253fadf81a97bf807d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0280 { + @State msg: string = ''; + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + cancel: () => { + this.msg = 'cancle is done'; + }, + sheets: [ + { + title: getContext().resourceManager.getStringSync($r('app.string.span')), + action: () => { + } + } + ] + }) + }) + Text(this.msg) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0290.ets new file mode 100755 index 0000000000000000000000000000000000000000..fdf9791818ea1614662f0f9b3b1d720169e5dd67 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0290.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0290 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + sheets: [ + { + title: 'apple', + action: () => { + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0300.ets new file mode 100755 index 0000000000000000000000000000000000000000..9da3c2358b703806e34b527293de1401bf5390a8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0300.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0300 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + width:'100%', + height:400, + sheets: [ + { + title: 'apple', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple1', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple2', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple3', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple4', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple5', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple6', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple7', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple8', + icon: 'cat.jpg', + action: () => { + } + }, + { + title: 'apple9', + icon: 'cat.jpg', + action: () => { + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0310.ets new file mode 100755 index 0000000000000000000000000000000000000000..22d7c48a31a0c2c0fd08ca9468a4688088f3efb0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0310.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0310 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + sheets: [ + { + icon:$r('app.media.cat'), + title: 'apple', + action: () => { + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0320.ets new file mode 100755 index 0000000000000000000000000000000000000000..9e4533813dd736e9126b36700ee3701ed0a04548 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0320.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxActionsheetInterfaceReplacement0320 { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('show ActionSheet') + .id('show') + .onClick(() => { + ActionSheet.show({ + title: 'title', + message: 'message', + alignment: DialogAlignment.Bottom, + sheets: [ + { + title: 'apple', + icon: 'cat.jpg', + action: () => { + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130.ets new file mode 100755 index 0000000000000000000000000000000000000000..d01c3ec14cbbbe387d2fe21b0548df9d082095f3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0130 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + gridCount: 100, + cancel: () => { + this.msg = 'cancel is done'; + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0140.ets new file mode 100755 index 0000000000000000000000000000000000000000..5bc34c3d334cdc135c881504e11f662503d4091e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0140.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0140 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + gridCount:-1, + primaryButton: { + value: 'ok', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0230.ets new file mode 100755 index 0000000000000000000000000000000000000000..a3990d7f239422b6d915870c882474bf26f41015 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0230.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0230 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + offset: { dx: getContext().resourceManager.getStringSync($r('app.string.10vp')), dy: getContext().resourceManager.getStringSync($r('app.string.10vp')) }, + primaryButton: { + value: 'ok', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0240.ets new file mode 100755 index 0000000000000000000000000000000000000000..0d9e33bda0c8288120ef01a9f8763fd594fa46a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0240.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0240 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + offset: { dx: '', dy: '' }, + primaryButton: { + value: 'ok', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270.ets new file mode 100755 index 0000000000000000000000000000000000000000..b81e477469e94a50d37e7328743e14c4166645d0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0270 { + @State msg: string = ''; + + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + primaryButton: { + value: 'primaryButton', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + this.msg = 'primaryButton is done'; + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280.ets new file mode 100755 index 0000000000000000000000000000000000000000..b7c46b380b80ffd76c2278bf4b39c6cd80f2baa5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0280 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + gridCount:-1, + primaryButton: { + value: 'ok', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'secondaryButton', + action: () => { + this.msg = 'secondaryButton is done'; + } + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370.ets new file mode 100755 index 0000000000000000000000000000000000000000..cac0d4c6daa3bfb4c7c1a44d62290e05bb86361a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0370 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + gridCount:-1, + primaryButton: { + value: getContext().resourceManager.getStringSync($r('app.string.primaryButton')), + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0390.ets new file mode 100755 index 0000000000000000000000000000000000000000..c00267d36134df7ed210f04bf396bb3701dd0d5b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0390.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0390 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Center, + primaryButton: { + value: 'ok', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'cancel', + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0410.ets new file mode 100755 index 0000000000000000000000000000000000000000..10ce2379d7134a0890ba696975976554fbaa6b6d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0410.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0410 { + build() { + Column({ space: 2 }) { + Button('two buttons dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560.ets new file mode 100755 index 0000000000000000000000000000000000000000..97bb344f094c79e605cc90cedca26d74d2c6e4ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0560 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + confirm: { + value: 'confirmButton', + action: () => { + } + }, + cancel: () => { + this.msg = 'cancel is done'; + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570.ets new file mode 100755 index 0000000000000000000000000000000000000000..701ee6f9120acb5b8dbe2e4765131371d5ac69fa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0570 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + confirm: { + value: 'confirmButton', + action: () => { + this.msg = 'confirm is done'; + } + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0690.ets new file mode 100755 index 0000000000000000000000000000000000000000..e3c0e496689010319fbb711fb87da2538876c9a5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0690.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0690 { + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.CenterStart, + gridCount: 100, + confirm: { + value: 'confirm', + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + } + }, + } + ) + }).backgroundColor(0x317aff) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0780.ets new file mode 100755 index 0000000000000000000000000000000000000000..53ab69cd65228a863267cd8ab00a67002b55f332 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0780.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0780 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + offset: { dx: '', dy: '' }, + alignment: DialogAlignment.CenterStart, + confirm: { + value: 'confirmButton', + action: () => { + } + }, + cancel: () => { + this.msg = 'cancel is done'; + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0800.ets new file mode 100755 index 0000000000000000000000000000000000000000..73fff737158b72e236b7d729fd1d56e099f30b3f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0800.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxAlertDialogInterfaceReplacement0800 { + @State msg : string = ''; + build() { + Column({ space: 2 }) { + Button('one button dialog') + .id('show') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + offset: { dx: -10, dy: -10 }, + alignment: DialogAlignment.Center, + confirm: { + value: 'confirmButton', + action: () => { + } + }, + cancel: () => { + this.msg = 'cancel is done'; + }, + } + ) + }).backgroundColor(0x317aff) + Text(this.msg) + }.width('100%').margin({ bottom: 50 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0010.ets new file mode 100755 index 0000000000000000000000000000000000000000..5c170ac4a53578dd7dea50ab5961f3040048ecdd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0010.ets @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxCalendarPickerFeatureReplacement0010 { + private selectedDate: Date = new Date('2024-12-25'); + @State changeRes: string = ''; + + build() { + Column() { + Text('日期选择器').fontSize(30) + Column() { + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .id('UIComponentPopupBoxCalendarPickerFeatureReplacement0010') + .edgeAlign(CalendarAlign.END) + .textStyle({ color: "#ff0000ff", font: { size: 20, weight: FontWeight.Normal } }) + .margin(10) + .onChange((value) => { + this.changeRes = JSON.stringify(value).substring(1,8); + }) + }.alignItems(HorizontalAlign.Center).width("100%").height('60%') + Text(this.changeRes).fontColor(Color.Orange).fontSize(16).margin(20) + }.width('100%').margin({ top: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0020.ets new file mode 100755 index 0000000000000000000000000000000000000000..cd6cb38280cac46b73bbd5802c993dddc13442b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0020.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxCalendarPickerFeatureReplacement0020 { + private selectedDate: Date = new Date('2024-12-01'); + + build() { + Column() { + Text('日期选择器').fontSize(30) + Column() { + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .id('UIComponentPopupBoxCalendarPickerFeatureReplacement0020') + .edgeAlign(CalendarAlign.END) + .textStyle({ color: "#ff0000ff", font: { size: 20, weight: FontWeight.Normal } }) + .margin(10) + .onChange((value) => { + }) + }.alignItems(HorizontalAlign.Center).width("100%").height('60%') + }.width('100%').margin({ top: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0030.ets new file mode 100755 index 0000000000000000000000000000000000000000..22364da7c8c33fe6e27353057b7debfdcf76f68f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0030.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxCalendarPickerFeatureReplacement0030 { + private selectedDate: Date = new Date('2025-01-01'); + + build() { + Column() { + Text('日期选择器').fontSize(30) + Column() { + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .id('UIComponentPopupBoxCalendarPickerFeatureReplacement0030') + .edgeAlign(CalendarAlign.END) + .textStyle({ color: "#ff0000ff", font: { size: 20, weight: FontWeight.Normal } }) + .margin(10) + .onChange((value) => { + }) + }.alignItems(HorizontalAlign.Center).width("100%").height('60%') + }.width('100%').margin({ top: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0040.ets new file mode 100755 index 0000000000000000000000000000000000000000..65dde225f7347278a5d834936fa95475810c9b47 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0040.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupBoxCalendarPickerFeatureReplacement0040 { + private selectedDate: Date = new Date('2024-2-29'); + + build() { + Column() { + Text('日期选择器').fontSize(30) + Column() { + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .id('UIComponentPopupBoxCalendarPickerFeatureReplacement0040') + .edgeAlign(CalendarAlign.END) + .textStyle({ color: "#ff0000ff", font: { size: 20, weight: FontWeight.Normal } }) + .margin(10) + .onChange((value) => { + }) + }.alignItems(HorizontalAlign.Center).width("100%").height('60%') + }.width('100%').margin({ top: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290.ets new file mode 100755 index 0000000000000000000000000000000000000000..b124525520b92a077b8be9c6dcd156e54a6d345c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0290 { + @State noDiv : boolean = false; + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(1.5,LengthUnit.VP), + startMargin: new LengthMetrics(2,LengthUnit.VP), + endMargin: new LengthMetrics(2,LengthUnit.VP), + color: Color.Pink + }) + } + @Builder + MyMenu1() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + } + + build() { + Row() { + Column() { + Button('noDiv') + .id('noDiv') + .onClick(()=>{ + this.noDiv = true; + }) + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(!this.noDiv ? this.MyMenu : this.MyMenu1(), ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0300.ets new file mode 100755 index 0000000000000000000000000000000000000000..59f321feacb7076178991f5448a9609d3ad59a9c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0300.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0300 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .padding('10vp') + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0310.ets new file mode 100755 index 0000000000000000000000000000000000000000..27823c4d5c8afadf71f1f04b42ef28f92330ee61 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0310.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0310 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(1.5,LengthUnit.VP), + startMargin: new LengthMetrics(50,LengthUnit.VP), + endMargin: new LengthMetrics(50,LengthUnit.VP), + color: Color.Pink + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0350.ets new file mode 100755 index 0000000000000000000000000000000000000000..216a230921f6321f594d8d2bd1c4674a0bf5555b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0350.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0350 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(1), + startMargin: new LengthMetrics(-10), + endMargin: new LengthMetrics(-10), + color: Color.Pink + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0360.ets new file mode 100755 index 0000000000000000000000000000000000000000..dd97af0e574d269cf4698afe9a6eb64e08dbbca9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0360.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0360 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(20,LengthUnit.PERCENT), + startMargin: new LengthMetrics(120,LengthUnit.LPX), + endMargin: new LengthMetrics(120,LengthUnit.LPX), + color: getContext().resourceManager.getStringSync($r('app.string.EntryAbilityLabel')) + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0370.ets new file mode 100755 index 0000000000000000000000000000000000000000..b0b5ae48a500d54344cad02050784e081d261079 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0370.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0370 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.FP), + startMargin: new LengthMetrics(60,LengthUnit.VP), + endMargin: new LengthMetrics(60,LengthUnit.VP), + color: Color.Red + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0380.ets new file mode 100755 index 0000000000000000000000000000000000000000..52051e76adbe8186174ef6773a0c669aa3e6aa28 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0380.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0380 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.LPX), + startMargin: new LengthMetrics(30,LengthUnit.PERCENT), + endMargin: new LengthMetrics(30,LengthUnit.PERCENT), + color: getContext().resourceManager.getStringSync($r('app.string.Color_green')) + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0390.ets new file mode 100755 index 0000000000000000000000000000000000000000..edf112144eaad4547748ccd00aba7ce79d9f2a15 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0390.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0390 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.LPX), + startMargin: new LengthMetrics(1.5,LengthUnit.FP), + endMargin: new LengthMetrics(1.5,LengthUnit.FP), + color: 'rgba(57, 47, 73, 0.2)' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0400.ets new file mode 100755 index 0000000000000000000000000000000000000000..e87f722aa6e34bf383435cbbf31b641e0711bb57 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0400.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0400 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.PX), + startMargin: new LengthMetrics(10,LengthUnit.PX), + endMargin: new LengthMetrics(10,LengthUnit.PX), + color: '0XFF3C4B34' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0410.ets new file mode 100755 index 0000000000000000000000000000000000000000..09071ccb65e248a23097da815615ff2c22c7b0ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0410.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0410 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(60), + startMargin: new LengthMetrics(1), + endMargin: new LengthMetrics(1), + color: '#392F49' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0420.ets new file mode 100755 index 0000000000000000000000000000000000000000..7af95b5c14926753398aabfdd80aeeef0db377a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0420.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0420 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(-10) + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0430.ets new file mode 100755 index 0000000000000000000000000000000000000000..fdde790ac586bc556cfdae7985f4df2f7f032220 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0430.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0430 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(-100000), + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0440.ets new file mode 100755 index 0000000000000000000000000000000000000000..f2e6e24cb423f929f9d54c4639d3b3f232b1b645 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0440.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0440 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: undefined, + startMargin: undefined, + endMargin: undefined, + color: undefined + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindContextMenu(this.MyMenu, ResponseType.LongPress) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0530.ets new file mode 100755 index 0000000000000000000000000000000000000000..fbb297d9dca591c287dbbc44ed3031bb8b2ba203 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0530.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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 UIComponentPopupboxMenuStyleEnhancementReplacement0530 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .padding('10vp') + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0610.ets new file mode 100755 index 0000000000000000000000000000000000000000..f7259577c435ab68a01d990d18dad6b8b5a0c475 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0610.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0610 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.LPX), + startMargin: new LengthMetrics(30,LengthUnit.PERCENT), + endMargin: new LengthMetrics(30,LengthUnit.PERCENT), + color: getContext().resourceManager.getStringSync($r('app.string.Color_green')) + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0620.ets new file mode 100755 index 0000000000000000000000000000000000000000..ac95a13ac2d9f5af94be16f2609efb416d18494f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0620.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0620 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.PX), + startMargin: new LengthMetrics(1.5,LengthUnit.FP), + endMargin: new LengthMetrics(1.5,LengthUnit.FP), + color: 'rgba(57, 47, 73, 0.2)' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0630.ets new file mode 100755 index 0000000000000000000000000000000000000000..b7f822c7da01fdfeeb6a51640ab29816f60685ef --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0630.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0630 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(3,LengthUnit.PX), + startMargin: new LengthMetrics(10,LengthUnit.PX), + endMargin: new LengthMetrics(10,LengthUnit.PX), + color: '0XFF3C4B34' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0640.ets new file mode 100755 index 0000000000000000000000000000000000000000..76c866c1a5ca8b3e3fcd5d7c39d6a23cb27ff4d7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0640.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0640 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(60), + startMargin: new LengthMetrics(1), + endMargin: new LengthMetrics(1), + color: '#392F49' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0650.ets new file mode 100755 index 0000000000000000000000000000000000000000..5f086d0b2df03c9d8e732bf9fcc485e1ad209475 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0650.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0650 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: new LengthMetrics(-10) + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0670.ets new file mode 100755 index 0000000000000000000000000000000000000000..12845249130d9daacf0b074c87fee8f5524a0d64 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0670.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0670 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + strokeWidth: undefined, + startMargin: undefined, + endMargin: undefined, + color: undefined + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0680.ets new file mode 100755 index 0000000000000000000000000000000000000000..2b3aab489f62ecb3a0b3334d484a706b05f9b12c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0680.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement0680 { + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + .width('240vp') + .height('60vp') + .menuItemDivider({ + color:'Color.Pink' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement1030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement1030.ets new file mode 100755 index 0000000000000000000000000000000000000000..c3ef34badf8ddb01b4e4f13552bc684d2632fce6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement1030.ets @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2024 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 { LengthMetrics, LengthUnit } from '@kit.ArkUI' + + +@Entry +@Component +struct UIComponentPopupboxMenuStyleEnhancementReplacement1030 { + private iconStr: ResourceStr = 'cat.jpg'; + private iconStr2: ResourceStr = 'cat.jpg'; + @Builder + SubMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + } + @Builder + MyMenu() { + Menu() { + MenuItemGroup() { + MenuItem({ + startIcon: this.iconStr, + content: "菜单选项", + endIcon: this.iconStr2, + builder: ():void=>this.SubMenu() + }) + MenuItem({ + startIcon: 'cat.jpg', + content: "菜单选项", + endIcon: this.iconStr2, + builder: ():void=>this.SubMenu() + }) + } + } + .width('240vp') + .height('160vp') + .subMenuExpandingMode(SubMenuExpandingMode.EMBEDDED_EXPAND) + .menuItemDivider({ + strokeWidth: new LengthMetrics(1), + startMargin: new LengthMetrics(1), + endMargin: new LengthMetrics(1), + color: '#392F49' + }) + } + + build() { + Row() { + Column() { + Text('displayMenu') + .id('display') + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + .height("100%") + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0570.ets new file mode 100755 index 0000000000000000000000000000000000000000..fd73991dad347a867f350174b51495fc980a752b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0570.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0570 { + @State theme: ThemeColorMode = ThemeColorMode.LIGHT; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + + Button('change') + .id('change') + .onClick(() => { + this.theme = ThemeColorMode.LIGHT; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0580.ets new file mode 100755 index 0000000000000000000000000000000000000000..8debf0751855aa66a5a0602098084832914095c2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0580.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0580 { + @State theme: ThemeColorMode = ThemeColorMode.LIGHT; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + + Button('change') + .id('change') + .onClick(() => { + this.theme = ThemeColorMode.DARK; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0590.ets new file mode 100755 index 0000000000000000000000000000000000000000..684006d3d86ce81bd0a2ad7dc3ab79ddfc8673f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0590.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0690 { + @State theme: ThemeColorMode = ThemeColorMode.DARK; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + + Button('change') + .id('change') + .onClick(() => { + this.theme = ThemeColorMode.LIGHT; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0600.ets new file mode 100755 index 0000000000000000000000000000000000000000..84a0f6202b1722fd4f9078852f3ca08859b5bfe1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0600.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0600 { + @State theme: ThemeColorMode = ThemeColorMode.DARK; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + + Button('change') + .id('change') + .onClick(() => { + this.theme = ThemeColorMode.DARK; + }) + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0610.ets new file mode 100755 index 0000000000000000000000000000000000000000..5599bf8887255b307d8e8ca4b64d0642c65c74a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0610.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0610 { + @State theme: ThemeColorMode = ThemeColorMode.LIGHT; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0620.ets new file mode 100755 index 0000000000000000000000000000000000000000..53639e72cfed63aa492bd33defed23b10c1a1a5d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0620.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0620 { + @State theme: ThemeColorMode = ThemeColorMode.DARK; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0630.ets new file mode 100755 index 0000000000000000000000000000000000000000..3c983ef43c31d58df3ce5451a124d4aa72d9fb95 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0630.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 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 UIComponentUISupportColorReplacement0630 { + @State theme: ThemeColorMode = ThemeColorMode.SYSTEM; + + build() { + Column() { + WithTheme({ colorMode: this.theme }) { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + } + .width('60%') + .height('40%') + .backgroundColor($r('sys.color.background_primary')) + } + }.justifyContent(FlexAlign.Center).width('100%').height("100%") + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponmentCanvasModifierReplacement/UIComponmentCanvasModifierReplacement1240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponmentCanvasModifierReplacement/UIComponmentCanvasModifierReplacement1240.ets new file mode 100755 index 0000000000000000000000000000000000000000..2f2a7a2355f568b68ec6c8dc04e5677d644f869a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponmentCanvasModifierReplacement/UIComponmentCanvasModifierReplacement1240.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 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 UIComponmentCanvasModifierReplacement1240 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .onReady(() => { + this.context.fillStyle = '#ffff00' + let grad = this.context.createLinearGradient(0, 0, 200, 0) + grad.addColorStop(0.0, '#ff0000') + grad.addColorStop(0.5, '#ffffff') + grad.addColorStop(1.0, '#00ff00') + this.context.fillStyle = grad + this.context.fillRect(0, 0, 200, 200) + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIAlertDialogInterfaceReplacement0420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIAlertDialogInterfaceReplacement0420.ets new file mode 100755 index 0000000000000000000000000000000000000000..822ac1e58dc002bd965bd4dd383d18920ea53db0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIAlertDialogInterfaceReplacement0420.ets @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 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 UIAlertDialogInterfaceReplacement0420 { + build() { + Column({ space: 5 }) { + Button('showDialog') + .id('UIAlertDialogInterfaceReplacement0420_button_01') + .onClick(() => { + // 建议使用this.getUIContext().showAlertDialog() + AlertDialog.show( + { + title: 'this is test text.this is test text.this is test text.this is test text.this is test text.this is test text.', + message: 'this is test text.', + autoCancel: true, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + width: 300, + height: 200, + backgroundColor: Color.White, + textStyle: { wordBreak: WordBreak.BREAK_ALL }, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + onWillDismiss:(dismissDialogAction: DismissDialogAction)=> { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + } + } + ) + }) + .backgroundColor(0x317aff) + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIPopuBoxCalendarPickerFeatureReplacement0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIPopuBoxCalendarPickerFeatureReplacement0050.ets new file mode 100755 index 0000000000000000000000000000000000000000..1fe946b218a4185bd194c33e3af982ae12be826b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIPopuBoxCalendarPickerFeatureReplacement0050.ets @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 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 UIPopuBoxCalendarPickerFeatureReplacement0050 { + private selectedDate: Date = new Date('2025-01-01') + + build() { + Column() { + Text('Calendar date picker').fontSize(30) + Column() { + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .id('UIPopuBoxCalendarPickerFeatureReplacement0050_button_01') + .edgeAlign(CalendarAlign.END) + .textStyle({ color: "#ff182431", font: { size: 20, weight: FontWeight.Normal } }) + .margin(10) + .onChange((value) => { + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + }.alignItems(HorizontalAlign.End).width("100%") + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIDialogSpeciFicationsHandReplacement0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIDialogSpeciFicationsHandReplacement0060.ets new file mode 100755 index 0000000000000000000000000000000000000000..e3f57e2d0cbb2fa75b2a0316f1247cbe84ac434b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIDialogSpeciFicationsHandReplacement0060.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 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 { promptAction } from '@kit.ArkUI' + +@Entry +@Component +struct UIDialogSpeciFicationsHandReplacement0060 { + @State showButton: boolean = true; + + build() { + Column() { + Button('Show toast').fontSize(20) + .onClick(() => { + this.showButton = !this.showButton; + promptAction.showToast({ + message: 'Hello World', + duration: 5000, + alignment: Alignment.Top + }) + }).visibility(this.showButton ? Visibility.Visible : Visibility.None).id('button_01') + TextInput({ placeholder: '拉起软键盘' }).margin({ top: 80 }).id('textInput_01') + }.height('100%').width('100%').justifyContent(FlexAlign.Start) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIPopuBoxSupportCustomIzationStyleReplacement0830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIPopuBoxSupportCustomIzationStyleReplacement0830.ets new file mode 100755 index 0000000000000000000000000000000000000000..aac6878e68cd347a8470cae149b9b3c9c6319984 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIPopuBoxSupportCustomIzationStyleReplacement0830.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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 { promptAction } from '@kit.ArkUI' + +@Entry +@Component +struct UIPopuBoxSupportCustomIzationStyleReplacement0830 { + build() { + Column() { + Button('Show toast').fontSize(20) + .onClick(() => { + promptAction.showToast({ + message: 'Hello World', + duration: 2000, + showMode: promptAction.ToastShowMode.TOP_MOST, + backgroundBlurStyle: undefined + }); + }).id('UIPopuBoxSupportCustomIzationStyle0830_button_01') + }.height('100%').width('100%').justifyContent(FlexAlign.Start) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIRenderComComponent/UIRenderComComponent0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIRenderComComponent/UIRenderComComponent0020.ets new file mode 100755 index 0000000000000000000000000000000000000000..728bdcb95bf16f7a859ba91243a82537e56bde3b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIRenderComComponent/UIRenderComComponent0020.ets @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2024 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. + */ +// 创建NodeController +import webview from '@ohos.web.webview'; +import { UIContext } from '@ohos.arkui.UIContext'; +import { NodeController, BuilderNode, NodeRenderType, FrameNode } from "@ohos.arkui.node"; + +@Observed +declare class Params { + elementId: string + textOne: string + textTwo: string + width: number + height: number +} + +declare class nodeControllerParams { + surfaceId: string + type: string + renderType: NodeRenderType + embedId: string + width: number + height: number +} + +// 用于控制和反馈对应的NodeContainer上的节点的行为,需要与NodeContainer一起使用。 +class MyNodeController extends NodeController { + private rootNode: BuilderNode<[Params]> | undefined | null; + private embedId_: string = ""; + private surfaceId_: string = ""; + private renderType_: NodeRenderType = NodeRenderType.RENDER_TYPE_DISPLAY; + private width_: number = 0; + private height_: number = 0; + private type_: string = ""; + private isDestroy_: boolean = false; + + setRenderOption(params: nodeControllerParams) { + this.surfaceId_ = params.surfaceId; + this.renderType_ = params.renderType; + this.embedId_ = params.embedId; + this.width_ = params.width; + this.height_ = params.height; + this.type_ = params.type; + } + + // 必须要重写的方法,用于构建节点数、返回节点数挂载在对应NodeContainer中。 + // 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新。 + makeNode(uiContext: UIContext): FrameNode | null { + if (this.isDestroy_) { // rootNode为null + return null; + } + if (!this.rootNode) { // rootNode 为undefined时 + this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ }); + if (this.rootNode) { + this.rootNode.build(wrapBuilder(TextAreaBuilder), + { textOne: "myTextArea", width: this.width_, height: this.height_ }) + return this.rootNode.getFrameNode(); + } else { + return null; + } + } + // 返回FrameNode节点。 + return this.rootNode.getFrameNode(); + } + + setBuilderNode(rootNode: BuilderNode | null): void { + this.rootNode = rootNode; + } + + getBuilderNode(): BuilderNode<[Params]> | undefined | null { + return this.rootNode; + } + + updateNode(arg: Object): void { + this.rootNode?.update(arg); + } + + getEmbedId(): string { + return this.embedId_; + } + + setDestroy(isDestroy: boolean): void { + this.isDestroy_ = isDestroy; + if (this.isDestroy_) { + this.rootNode = null; + } + } + + postEvent(event: TouchEvent | undefined): boolean { + return this.rootNode?.postTouchEvent(event) as boolean + } +} + +@Component +struct TextAreaComponent { + @ObjectLink params: Params + @State bgColor: Color = Color.White + @State msg: string = '' + + build() { + Column() { + Text('这是Text') + .id(this.params?.elementId) + .caretColor(Color.Gray) + .fontSize(fontSize) + .fontColor(Color.Black) + } + //自定义组件中的最外层容器组件宽高应该为同层标签的宽高 + .width(this.params.width) + .height(this.params.height).visibility(visibility) + } +} + +let fontSize: number = 150; +let visibility: Visibility = Visibility.Visible; + +// @Builder中为动态组件的具体组件内容。 +@Builder +function TextAreaBuilder(params: Params) { + TextAreaComponent({ params: params }) + .width(params.width) + .height(params.height) +} + +@Entry +@Component +struct UIRenderComComponent0020 { + @State controller: webview.WebviewController = new webview.WebviewController() + private nodeControllerMap: Map = new Map(); + @State componentIdArr: Array = []; + @State posMap: Map = new Map(); + @State widthMap: Map = new Map(); + @State heightMap: Map = new Map(); + @State positionMap: Map = new Map(); + @State edges: Edges = {}; + @State widthNum: number = 0; + @State _width: number = 500; + @State _height: number = 800; + @State renderType: NodeRenderType = NodeRenderType.RENDER_TYPE_TEXTURE; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + Button('UPDATE').id('btn1').onClick(() => { + this._width -= 100; + fontSize -= 100; + this.controller.refresh(); + }) + Button('NodeRenderType切换').id('btn2').onClick(() => { + this.renderType = + (this.renderType == NodeRenderType.RENDER_TYPE_TEXTURE) ? NodeRenderType.RENDER_TYPE_DISPLAY : + NodeRenderType.RENDER_TYPE_TEXTURE; + this.controller.refresh(); + }) + } + + Row() { + Column() { + Stack() { + ForEach(this.componentIdArr, (componentId: string) => { + NodeContainer(this.nodeControllerMap.get(componentId)) + .position(this.positionMap.get(componentId)) + .width(this.widthMap.get(componentId)) + .height(this.heightMap.get(componentId)) + }, (embedId: string) => embedId) + // Web组件加载本地text.html页面。 + Web({ src: $rawfile("text.html"), controller: this.controller })// 配置同层渲染开关开启。 + .enableNativeEmbedMode(true)// 获取embed标签的生命周期变化数据。 + .width(this._width) + .height(this._height) + .onNativeEmbedLifecycleChange((embed) => { + console.log("NativeEmbed surfaceId" + embed.surfaceId); + // 如果使用embed.info.id作为映射nodeController的key,请在h5页面显式指定id + const componentId = embed.info?.id?.toString() as string + if (embed.status == NativeEmbedStatus.CREATE) { + console.log("NativeEmbed create" + JSON.stringify(embed.info)); + // 创建节点控制器、设置参数并rebuild + let nodeController = new MyNodeController() + // embed.info.width和embed.info.height单位是px格式,需要转换成ets侧的默认单位vp + nodeController.setRenderOption({ + surfaceId: embed.surfaceId as string, + type: embed.info?.type as string, + renderType: this.renderType, + embedId: embed.embedId as string, + width: px2vp(embed.info?.width), + height: px2vp(embed.info?.height) + }) + this.edges = + { left: `${embed.info?.position?.x as number}px`, top: `${embed.info?.position?.y as number}px` } + nodeController.setDestroy(false); + //根据web传入的embed的id属性作为key,将nodeController存入Map + this.nodeControllerMap.set(componentId, nodeController); + this.widthMap.set(componentId, px2vp(embed.info?.width)); + this.heightMap.set(componentId, px2vp(embed.info?.height)); + this.positionMap.set(componentId, this.edges); + // 将web传入的embed的id属性存入@State状态数组变量中,用于动态创建nodeContainer节点容器,需要将push动作放在set之后 + this.componentIdArr.push(componentId) + } else if (embed.status == NativeEmbedStatus.UPDATE) { + let nodeController = this.nodeControllerMap.get(componentId); + console.log("NativeEmbed update" + JSON.stringify(embed)); + this.edges = + { left: `${embed.info?.position?.x as number}px`, top: `${embed.info?.position?.y as number}px` } + this.positionMap.set(componentId, this.edges); + this.widthMap.set(componentId, px2vp(embed.info?.width)); + this.heightMap.set(componentId, px2vp(embed.info?.height)); + nodeController?.updateNode({ + textOne: 'update', + width: px2vp(embed.info?.width), + height: px2vp(embed.info?.height) + } as ESObject) + } else if (embed.status == NativeEmbedStatus.DESTROY) { + console.log("NativeEmbed destroy" + JSON.stringify(embed)); + let nodeController = this.nodeControllerMap.get(componentId); + nodeController?.setDestroy(true) + this.nodeControllerMap.clear(); + this.positionMap.delete(componentId); + this.widthMap.delete(componentId); + this.heightMap.delete(componentId); + this.componentIdArr.filter((value: string) => value != componentId) + } else { + console.log("NativeEmbed status" + embed.status); + } + }) + } + } + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010.ets new file mode 100755 index 0000000000000000000000000000000000000000..ad84c7f28c920544d9d83654c6521b941d5a95d0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 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 { webview } from '@kit.ArkWeb' + +@Entry +@Component +struct UIWebDrawPipeline0010 { + browserTabController: WebviewController = new webview.WebviewController() + @State fontSize: number = 130; + @State webAdjustSize: number = 0; + @State _width: number= 500; + @State _height: number = 600; + + build() { + Column({ space: 10 }) { + Row() { + Column() { + Stack() { + // Web组件加载本地text.html页面。 + Web({ src: $rawfile("text.html"), controller: this.browserTabController })// 配置同层渲染开关开启。 + .enableNativeEmbedMode(true)// 获取embed标签的生命周期变化数据。 + .defaultFontSize(this.fontSize) + .width('100%') + .height('100%') + } + } + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050.ets new file mode 100755 index 0000000000000000000000000000000000000000..b973cc94e49d04be14ec40632c51b6a5344f7511 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050.ets @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2024 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. + */ +// 创建NodeController +import webview from '@ohos.web.webview'; +import { UIContext } from '@ohos.arkui.UIContext'; +import { NodeController, BuilderNode, NodeRenderType, FrameNode } from "@ohos.arkui.node"; + +@Observed +declare class Params { + elementId: string + textOne: string + textTwo: string + width: number + height: number +} + +declare class nodeControllerParams { + surfaceId: string + type: string + renderType: NodeRenderType + embedId: string + width: number + height: number +} + +// 用于控制和反馈对应的NodeContainer上的节点的行为,需要与NodeContainer一起使用。 +class MyNodeController extends NodeController { + private rootNode: BuilderNode<[Params]> | undefined | null; + private embedId_: string = ""; + private surfaceId_: string = ""; + private renderType_: NodeRenderType = NodeRenderType.RENDER_TYPE_DISPLAY; + private width_: number = 0; + private height_: number = 0; + private type_: string = ""; + private isDestroy_: boolean = false; + + setRenderOption(params: nodeControllerParams) { + this.surfaceId_ = params.surfaceId; + this.renderType_ = params.renderType; + this.embedId_ = params.embedId; + this.width_ = params.width; + this.height_ = params.height; + this.type_ = params.type; + } + + // 必须要重写的方法,用于构建节点数、返回节点数挂载在对应NodeContainer中。 + // 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新。 + makeNode(uiContext: UIContext): FrameNode | null { + if (this.isDestroy_) { // rootNode为null + return null; + } + if (!this.rootNode) { // rootNode 为undefined时 + this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ }); + if (this.rootNode) { + this.rootNode.build(wrapBuilder(TextAreaBuilder), + { textOne: "myTextArea", width: this.width_, height: this.height_ }) + return this.rootNode.getFrameNode(); + } else { + return null; + } + } + // 返回FrameNode节点。 + return this.rootNode.getFrameNode(); + } + + setBuilderNode(rootNode: BuilderNode | null): void { + this.rootNode = rootNode; + } + + getBuilderNode(): BuilderNode<[Params]> | undefined | null { + return this.rootNode; + } + + updateNode(arg: Object): void { + this.rootNode?.update(arg); + } + + getEmbedId(): string { + return this.embedId_; + } + + setDestroy(isDestroy: boolean): void { + this.isDestroy_ = isDestroy; + if (this.isDestroy_) { + this.rootNode = null; + } + } + + postEvent(event: TouchEvent | undefined): boolean { + return this.rootNode?.postTouchEvent(event) as boolean + } +} + +@Component +struct TextAreaComponent { + @ObjectLink params: Params + @State bgColor: Color = Color.White + @State msg: string = '' + + build() { + Column() { + Text('这是Text') + .id(this.params?.elementId) + .caretColor(Color.Gray) + .fontSize(fontSize) + .fontColor(Color.Black) + } + //自定义组件中的最外层容器组件宽高应该为同层标签的宽高 + .width(this.params.width) + .height(this.params.height).visibility(visibility) + } +} + +let fontSize: number = 150; +let visibility: Visibility = Visibility.Visible; + +// @Builder中为动态组件的具体组件内容。 +@Builder +function TextAreaBuilder(params: Params) { + TextAreaComponent({ params: params }) + .width(params.width) + .height(params.height) +} + +@Entry +@Component +struct UIWebDrawPipeline0050 { + @State controller: webview.WebviewController = new webview.WebviewController() + private nodeControllerMap: Map = new Map(); + @State componentIdArr: Array = []; + @State posMap: Map = new Map(); + @State widthMap: Map = new Map(); + @State heightMap: Map = new Map(); + @State positionMap: Map = new Map(); + @State edges: Edges = {}; + @State widthNum: number = 0; + @State _width: number = 500; + @State _height: number = 800; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + Button('Text显隐切换').id('btn5').onClick(() => { + visibility = (visibility == Visibility.Visible) ? Visibility.None : Visibility.Visible; + fontSize -= 50; + this.controller.refresh(); + }) + Button('web refresh').id('btn6').onClick(() => { + this.controller.refresh(); + }) + } + + Row({ space: 10 }) { + Button('webSize -100').id('btn1').onClick(() => { + this._width -= 100; + this._height -= 100; + }) + Button('webSize +100').id('btn2').onClick(() => { + this._width += 100; + this._height += 100; + }) + } + + Row({ space: 10 }) { + Button('fontSize -100').id('btn3').onClick(() => { + fontSize -= 100; + this.controller.refresh(); + }) + Button('fontSize +100').id('btn4').onClick(() => { + fontSize += 100; + this.controller.refresh(); + }) + }.margin({ bottom: 20 }) + + Row() { + Column() { + Stack() { + ForEach(this.componentIdArr, (componentId: string) => { + NodeContainer(this.nodeControllerMap.get(componentId)) + .position(this.positionMap.get(componentId)) + .width(this.widthMap.get(componentId)) + .height(this.heightMap.get(componentId)) + }, (embedId: string) => embedId) + // Web组件加载本地text.html页面。 + Web({ src: $rawfile("text.html"), controller: this.controller })// 配置同层渲染开关开启。 + .enableNativeEmbedMode(true)// 获取embed标签的生命周期变化数据。 + .width(this._width) + .height(this._height) + .onNativeEmbedLifecycleChange((embed) => { + console.log("NativeEmbed surfaceId" + embed.surfaceId); + // 如果使用embed.info.id作为映射nodeController的key,请在h5页面显式指定id + const componentId = embed.info?.id?.toString() as string + if (embed.status == NativeEmbedStatus.CREATE) { + console.log("NativeEmbed create" + JSON.stringify(embed.info)); + // 创建节点控制器、设置参数并rebuild + let nodeController = new MyNodeController() + // embed.info.width和embed.info.height单位是px格式,需要转换成ets侧的默认单位vp + nodeController.setRenderOption({ + surfaceId: embed.surfaceId as string, + type: embed.info?.type as string, + renderType: NodeRenderType.RENDER_TYPE_TEXTURE, + embedId: embed.embedId as string, + width: px2vp(embed.info?.width), + height: px2vp(embed.info?.height) + }) + this.edges = + { left: `${embed.info?.position?.x as number}px`, top: `${embed.info?.position?.y as number}px` } + nodeController.setDestroy(false); + //根据web传入的embed的id属性作为key,将nodeController存入Map + this.nodeControllerMap.set(componentId, nodeController); + this.widthMap.set(componentId, px2vp(embed.info?.width)); + this.heightMap.set(componentId, px2vp(embed.info?.height)); + this.positionMap.set(componentId, this.edges); + // 将web传入的embed的id属性存入@State状态数组变量中,用于动态创建nodeContainer节点容器,需要将push动作放在set之后 + this.componentIdArr.push(componentId) + } else if (embed.status == NativeEmbedStatus.UPDATE) { + let nodeController = this.nodeControllerMap.get(componentId); + console.log("NativeEmbed update" + JSON.stringify(embed)); + this.edges = + { left: `${embed.info?.position?.x as number}px`, top: `${embed.info?.position?.y as number}px` } + this.positionMap.set(componentId, this.edges); + this.widthMap.set(componentId, px2vp(embed.info?.width)); + this.heightMap.set(componentId, px2vp(embed.info?.height)); + nodeController?.updateNode({ + textOne: 'update', + width: px2vp(embed.info?.width), + height: px2vp(embed.info?.height) + } as ESObject) + } else if (embed.status == NativeEmbedStatus.DESTROY) { + console.log("NativeEmbed destroy" + JSON.stringify(embed)); + let nodeController = this.nodeControllerMap.get(componentId); + nodeController?.setDestroy(true) + this.nodeControllerMap.clear(); + this.positionMap.delete(componentId); + this.widthMap.delete(componentId); + this.heightMap.delete(componentId); + this.componentIdArr.filter((value: string) => value != componentId) + } else { + console.log("NativeEmbed status" + embed.status); + } + }) + } + } + } + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json index ce65c09bf1f31a1214be8ab75ed207896afea2d3..854b7ebe532a1b9ae7608db697555b0a42772b3e 100644 --- a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json @@ -243,6 +243,22 @@ { "name": "20string", "value": "20" + }, + { + "name": "Color_green", + "value": "#00FF00" + }, + { + "name": "EntryAbilityLabel", + "value": "#0000FF" + }, + { + "name": "10vp", + "value": "10vp" + }, + { + "name": "primaryButton", + "value": "primaryButton" } ] } \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/caiyuan.jpg b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/caiyuan.jpg new file mode 100755 index 0000000000000000000000000000000000000000..a5fe3a15a2ebe767e811aad2917f06860f88ee26 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/caiyuan.jpg differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json index 5cc05ce92cff61b76d701a3fe495c11c73638078..b04dc0ced6b41e41040f04e41da716da9f40d16f 100644 --- a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -1801,6 +1801,173 @@ "testability/pages/UIComponentPopupBoxFullDialogInterface/UIComponentPopupBoxFullDialogInterface007", "testability/pages/UIComponentPopupBoxFullDialogInterface/UIComponentPopupBoxFullDialogInterface008", "testability/pages/UIComponentPopupBoxFullDialogInterface/UIComponentPopupBoxFullDialogInterface009", - "testability/pages/UIComponentPopupBoxFullDialogInterface/UIComponentPopupBoxFullDialogInterface0010" + "testability/pages/UIComponentPopupBoxFullDialogInterface/UIComponentPopupBoxFullDialogInterface0010", + + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup001", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup002", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup003", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup004", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup005", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup006", + "testability/pages/UIAttributeFontInterfacePopup/UIAttributeFontInterfacePopup007", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu001", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu002", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu003", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu004", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu005", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu006", + "testability/pages/UIAttributeFontInterfaceMenu/UIAttributeFontInterfaceMenu007", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton001", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton002", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton003", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas001", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas002", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas003", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas004", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas005", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas006", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle001", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle002", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle003", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle004", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle005", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog001", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog002", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog003", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog004", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog005", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog006", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog007", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage001", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage002", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage003", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage004", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage005", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage006", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider001", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider002", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider003", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider004", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider005", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider006", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider007", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText001", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText002", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText003", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText004", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText005", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo001", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo002", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo003", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo004", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo005", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo006", + "testability/pages/UIAttributeFontInterfaceVideo/UIAttributeFontInterfaceVideo007", + "testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0010", + "testability/pages/UIWebDrawPipeline/UIWebDrawPipeline0050", + "testability/pages/UIRenderComComponent/UIRenderComComponent0020", + + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0530", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0640", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0610", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0620", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0650", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0630", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0370", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0380", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0360", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0350", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0400", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0410", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0390", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0420", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0440", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0430", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement1030", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0290", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0300", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0680", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0670", + "testability/pages/UIComponentPopupboxMenuStyleEnhancementReplacement/UIComponentPopupboxMenuStyleEnhancementReplacement0310", + + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0570", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0610", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0600", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0630", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0590", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0580", + "testability/pages/UIComponentUISupportColorReplacement/UIComponentUISupportColorReplacement0620", + + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0320", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0300", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0230", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0290", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0270", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0280", + "testability/pages/UIComponentPopupBoxActionsheetInterfaceReplacement/UIComponentPopupBoxActionsheetInterfaceReplacement0310", + + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0390", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0690", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0240", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0130", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0570", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0560", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0230", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0140", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0270", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0780", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0800", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0370", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0280", + "testability/pages/UIComponentPopupBoxAlertDialogInterfaceReplacement/UIComponentPopupBoxAlertDialogInterfaceReplacement0410", + + "testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0010", + "testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0020", + "testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0030", + "testability/pages/UIComponentPopupBoxCalendarPickerFeatureReplacement/UIComponentPopupBoxCalendarPickerFeatureReplacement0040", + + "testability/pages/SubAceStatusManagerDataDotting/SubAceStatusManagerDataDotting0010", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton004", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0190", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0310", + "testability/pages/UIAttributeFontInterfaceButton/UIAttributeFontInterfaceButton0320", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0140", + "testability/pages/UIAttributeFontInterfaceText/UIAttributeFontInterfaceText0200", + "testability/pages/UIAttributeFontInterfaceCanvas/UIAttributeFontInterfaceCanvas007", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0270", + "testability/pages/UIAttributeFontInterfaceCircle/UIAttributeFontInterfaceCircle0210", + "testability/pages/UIAttributeFontInterfaceImage/UIAttributeFontInterfaceImage0220", + "testability/pages/UIAttributeFontInterfaceSlider/UIAttributeFontInterfaceSlider0180", + "testability/pages/UIAttributeFontInterfaceCustomDialog/UIAttributeFontInterfaceCustomDialog0330", + "testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0040", + "testability/pages/UIAttributeFontInterfaceDarkMode/UIAttributeFontInterfaceDarkMode0050", + "testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIDialogSpeciFicationsHandReplacement0060", + "testability/pages/UIPopuBoxSupportCustomIzationStyleReplacement/UIPopuBoxSupportCustomIzationStyleReplacement0830", + "testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIPopuBoxCalendarPickerFeatureReplacement0050", + "testability/pages/UIPopuBoxAlertDialogCalendarPickerReplacement/UIAlertDialogInterfaceReplacement0420", + "testability/pages/UIComponmentCanvasModifierReplacement/UIComponmentCanvasModifierReplacement1240", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0010", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0020", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0030", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0040", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0050", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0060", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0090", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0100", + "testability/pages/DFXScrollEventObserver/DFXScrollEventObserver0110", + "testability/pages/DFXDraw/DFXDraw0010", + "testability/pages/UIAnimationCustomTransitionInterface/UIAnimationCustomTransitionInterface0050", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0020", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0040", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0060", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0090", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0110", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0130", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0170", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0180", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0190", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0200", + "testability/pages/UIAnimationParticleOption/UIAnimationParticleOption0230", + "testability/pages/UIAnimationParticleSpin/UIAnimationParticleSpin0090" ] } diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json index d1049d56ac4487a3f44a6e5e0b26117519e7ea43..4e49061391c5f746070ae8bba038d677db2612df 100644 --- a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json @@ -1,8 +1,8 @@ -{ - "string": [ - { - "name": "rawfile_string", - "value": "10vp" - } - ] +{ + "string": [ + { + "name": "rawfile_string", + "value": "10vp" + } + ] } \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/text.html b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/text.html new file mode 100755 index 0000000000000000000000000000000000000000..3bd3b99dd98d08974900f573b2849c80b0fa666f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/text.html @@ -0,0 +1,27 @@ + + + + + Demo + + + +Scroll Test + + + + + + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/video1.ts b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/video1.ts new file mode 100755 index 0000000000000000000000000000000000000000..dd6d86aec327dd7f5c367f41c5e492b2923fa1f5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/video1.ts @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file + * @kit ArkUI + */ + + + +import { Callback } from './@ohos.base'; +import window from './@ohos.window'; +/** + * uiExtension. + * + * @namespace uiExtension + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +declare namespace uiExtension { + /** + * The proxy of the UIExtension window. + * + * @interface WindowProxy + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface WindowProxy { + /** + * Get the avoid area. + * + * @param { window.AvoidAreaType } type - Type of the avoid area. + * @returns { window.AvoidArea } Area where the window cannot be displayed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + getWindowAvoidArea(type: window.AvoidAreaType): window.AvoidArea; + + /** + * Register the callback of avoidAreaChange. + * + * @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area. + * @param { Callback } callback - Callback used to return the avoid area information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + on(type: 'avoidAreaChange', callback: Callback): void; + + /** + * Unregister the callback of avoidAreaChange. + * + * @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area. + * @param { Callback } callback - Callback used to return the avoid area information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + off(type: 'avoidAreaChange', callback?: Callback): void; + + /** + * Register the callback of windowSizeChange. + * + * @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event. + * @param { Callback } callback - Callback used to return the window size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + on(type: 'windowSizeChange', callback: Callback): void; + + /** + * Unregister the callback of windowSizeChange. + * + * @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event. + * @param { Callback } callback - Callback used to return the window size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + off(type: 'windowSizeChange', callback?: Callback): void; + + /** + * Hide the non-secure windows. + * When called by modal UIExtension and shouldHide == false, the "ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS" permission is required. + * + * @permission ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS + * @param { boolean } shouldHide - Hide the non-secure windows if true, otherwise means the opposite. + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 1300002 - Abnormal state. Possible causes: + *
1. Permission denied. Interface caller does not have permission "ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS". + *
2. The UIExtension window proxy is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 12 + */ + hideNonSecureWindows(shouldHide: boolean): Promise; + + /** + * Create sub window. + * + * @param { string } name - window name of sub window. + * @param { window.SubWindowOptions } subWindowOptions - options of sub window creation. + * @returns { Promise } Promise used to return the subwindow. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300005 - This window proxy is abnormal. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @StageModelOnly + * @atomicservice + * @since 12 + */ + createSubWindowWithOptions(name: string, subWindowOptions: window.SubWindowOptions): Promise; + + /** + * Set the watermark flag on the UIExtension window + * + * @param { boolean } enable - Add water mark flag to the UIExtension window if true, or remove flag if false + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 1300002 - The UIExtension window proxy is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @throws { BusinessError } 1300008 - The display device is abnormal. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 12 + */ + setWaterMarkFlag(enable: boolean): Promise; + + /** + * The properties of the UIExtension window + * + * @type { WindowProxyProperties } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 14 + */ + properties: WindowProxyProperties; + } + + /** + * Defines the avoid area information. + * + * @interface AvoidAreaInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface AvoidAreaInfo { + /** + * Describes the type of avoid area. + * + * @type { window.AvoidAreaType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + type: window.AvoidAreaType; + + /** + * Describes the position and size of avoid area. + * + * @type { window.AvoidArea } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + area: window.AvoidArea; + } + + /** + * Properties of UIExtension window + * + * @interface WindowProxyProperties + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 14 + * + */ + interface WindowProxyProperties { + /** + * The position and size of the UIExtension window + * + * @type { window.Rect } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 14 + */ + uiExtensionHostWindowProxyRect: window.Rect; + } +} + +export default uiExtension;