diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit.test.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e143665c22cdaca84da4a51d830a81aca0a51997 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit/ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit.test.ets @@ -0,0 +1,531 @@ +/* + * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, Level } 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,Component ,MouseButton } from '@ohos.UiTest' +/* + * SUB_ACE_UI_ATTRIBUTES_FONT_INTERFACE_0010:设置文本颜色 + * + * 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 ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit() { + + describe('ArkuiSpecialComponentsDialogCalendarPickerDialogDarHabit', () => { + 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_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0030 + * @tc.name When the language is set to Chinese Simplified, the verification does not affect the callback of the onChange event in the CalendarPickerDialog + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0030', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0030 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit01") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit01_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit01_02'),1000); + let point = await button02.getBoundsCenter() + await button01.click() + await button02.click() + await Utils.sleep(1000) + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await driver.mouseClick({x:point.x, y:point.y}, MouseButton.MOUSE_BUTTON_LEFT); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0030 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0100 + * @tc.name If the language is set to Chinese Traditional (Chinese Traditional Hong Kong, Chinese Traditional Taiwan), the callback of the onChange event in the CalendarPickerDialog is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0100', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0100 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit02") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit02_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit02_02'),1000); + let button03: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit02_03'),1000); + windowSnap.snapShot() + let point = await button02.getBoundsCenter() + await button01.click() + await button03.click() + await driver.click(point.x,point.y) + await Utils.sleep(1000) + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await button02.click(); + await driver.waitForIdle(500,2000) + await button03.click() + await driver.click(point.x-10,point.y) + await Utils.sleep(1000) + windowSnap.snapShot() + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0100 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0050 + * @tc.name When the language is set to Chinese Simplified, verification does not affect the display of TextStyle + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0050', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0050 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit03") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit03_01'),1000); + await button01.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0050 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0120 + * @tc.name When the language is set to Chinese Traditional (Chinese Traditional Hong Kong,Chinese Traditional Taiwan),the verification does not affect the display of TextStyle (text style in the entry area) + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0120', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0120 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit04") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit04_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit04_02'),1000); + await button01.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await button02.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0120 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0040 + * @tc.name When the language is set to Chinese Simplified, verify that the callback of the onChange event in CalendarPicker is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0040', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0040 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit05") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit05_01'),1000); + let CalendarPicker01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit05_02'),1000); + let point = await CalendarPicker01.getBoundsCenter() + await button01.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await CalendarPicker01.click(); + await driver.click(point.x,point.y) + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0040 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0110 + * @tc.name When the language is set to Chinese Simplified, verify that the callback of the onChange event in CalendarPicker is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0110', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0110 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit06") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit06_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit06_02'),1000); + let CalendarPicker01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit06_03'),1000); + let text: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit06_04'),1000); + let point = await CalendarPicker01.getBoundsCenter() + await button01.click(); + await driver.waitForIdle(500,2000) + await CalendarPicker01.click(); + await driver.click(point.x,point.y) + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await text.doubleClick(); + await button02.click(); + await driver.waitForIdle(500,2000) + await CalendarPicker01.click(); + await driver.click(point.x-20,point.y-10) + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0110 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0170 + * @tc.name When the language is set to Ug, validation does not affect the callback of the onChange event in the CalendarPickerDialog + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0170', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0170 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit07") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit07_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit07_02'),1000); + let point = await button02.getBoundsCenter(); + await button01.click() + await button02.click() + await driver.waitForIdle(500,2000) + await driver.click(point.x,point.y) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0170 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0180 + * @tc.name When the language is set to Ug, validation does not affect the callback of the onChange event in the CalendarPicker + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0180', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0180 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit08") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit08_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit08_02'),1000); + let CalendarPicker01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit08_03'),1000); + let text: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit08_04'),1000); + windowSnap.snapShot() + let point = await CalendarPicker01.getBoundsCenter(); + await button01.click() + await CalendarPicker01.click() + await driver.click(point.x,point.y) + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await text.doubleClick(); + await button02.click(); + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0180 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0190 + * @tc.name When the language is set to Ug, validation does not affect the callback of the textStyle in the CalendarPicker + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0190', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0190 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit09") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit09_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit09_02'),1000); + windowSnap.snapShot() + await button01.click() + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click(); + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0190 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0090 + * @tc.name If the language is set to Chinese Traditional (Chinese Traditional Hong Kong,Chinese Traditional Taiwan),verify that the correctness of the value returned by the onAccept event in the CalendarPickerDialog is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0090', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0090 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit10") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit10_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit10_02'),1000); + let button03: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit10_03'),1000); + windowSnap.snapShot() + let point = await button02.getBoundsCenter() + await button01.click() + await button03.click() + await driver.waitForIdle(500,2000) + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click(); + await button03.click() + await driver.waitForIdle(500,2000) + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0090 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0230 + * @tc.name If the language is set to Chinese Traditional (Chinese Traditional Hong Kong,Chinese Traditional Taiwan),verify that the correctness of the value returned by the onAccept event in the CalendarPickerDialog is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0230', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0230 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit11") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit11_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit11_02'),1000); + let button03: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit11_03'),1000); + windowSnap.snapShot() + await button01.click() + await button03.click() + await Utils.sleep(1000) + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + windowSnap.snapShot() + await button02.click() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0230 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0240 + * @tc.name If the language is set to Chinese Traditional (Chinese Traditional Hong Kong,Chinese Traditional Taiwan),verify that the correctness of the value returned by the onChange event in the CalendarPickerDialog is not affected + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0240', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0240 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit12") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit12_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit12_02'),1000); + let button03: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit12_03'),1000); + let point = await button02.getBoundsCenter(); + windowSnap.snapShot() + await button01.click() + await button03.click() + await driver.click(point.x,point.y) + await Utils.sleep(1000) + windowSnap.snapShot() + await driver.mouseClick({x:500, y:1000}, MouseButton.MOUSE_BUTTON_LEFT); + await button02.click() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0240 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0260 + * @tc.name When the language is set to en, verification does not affect the display of TextStyle + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0260', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0260 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit13") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit13_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit13_03'),1000); + await button01.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await button02.click(); + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0260 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0330 + * @tc.name When the language is set to bo-CN, verification does not affect the display of TextStyle + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0330', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0330 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit14") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit14_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit14_03'),1000); + await button01.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await button02.click(); + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0330 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0250 + * @tc.name When the language is set to English, the validation does not affect the callback of the onChange event in the CalendarPicker + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0250', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0250 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit15") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit15_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit15_02'),1000); + let CalendarPicker: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit15_03'),1000); + let text: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit15_04'),1000); + let point = await CalendarPicker.getBoundsCenter(); + await button01.click() + await CalendarPicker.click() + await driver.waitForIdle(500,2000) + await driver.click(point.x,point.y) + await text.doubleClick(); + await button02.click(); + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0250 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0320 + * @tc.name When the language is set to bo-CN, verify that it does not affect the callback of the onChange event in CalendarPicker + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0320', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0320 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit16") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit16_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit16_02'),1000); + let CalendarPicker: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit16_03'),1000); + let text: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit16_04'),1000); + let point = await CalendarPicker.getBoundsCenter(); + await button01.click() + await CalendarPicker.click() + await driver.waitForIdle(500,2000) + await driver.click(point.x,point.y) + await text.doubleClick(); + await button02.click(); + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0320 finish.`); + done() + }) + + /* + * @tc.number ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0310 + * @tc.name When the language is set to bo-CN, validation does not affect the callback of the onChange event in the CalendarPickerDialog + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0310', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0310 start.`); + Settings.createWindow("testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit17") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit17_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('ArkuiSpecialComponentsDialogCalenDarHabit17_02'),1000); + let point = await button02.getBoundsCenter(); + await button01.click() + await button02.click() + await driver.waitForIdle(500,2000) + await driver.click(point.x,point.y) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `ARKUI_COMPONENTFUNCTION_SPECIALCOMPONENTS_DIALOG_CALENDAR_HABIT_0310 finish.`); + done() + }) + + }) +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius.test.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa0a1522ba53af97bea035a577047213036948a0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius.test.ets @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, Level } 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,Component ,MouseButton } from '@ohos.UiTest' +/* + * SUB_ACE_UI_ATTRIBUTES_FONT_INTERFACE_0010:设置文本颜色 + * + * 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 UiComponentButtonButtonRadius() { + + describe('UiComponentButtonButtonRadius', () => { + 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_BUTTON_BUTTON_RADIUS_0410 + * @tc.name Verify that the general attribute Type is set to default,controlSize is set to normal,and the borderRadius is manually set to 30px + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0410', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0410 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius01") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius01_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius01_02'),1000); + await button01.click() + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0410 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0400 + * @tc.name Verify that the general attribute Type is set to default,controlSize is set to normal,and the borderRadius is manually set to 30% + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0400', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0400 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius02") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius02_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius02_02'),1000); + await button01.click() + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0400 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0360 + * @tc.name Verify that the general attribute Type is set to default,controlSize is set to normal,and the borderRadius is manually set to 10vp + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0360', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0360 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius03") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius03_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius03_02'),1000); + await button01.click() + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0360 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0010 + * @tc.name Verify that buttonStyle is set to a different value and it works properly + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0010', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0010 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius04") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius04_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius04_02'),1000); + await button01.click() + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0010 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0240 + * @tc.name Verify that the default style of the calendarPickerDialog button is capsule and displayed correctly in api18 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0240', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0240 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius05") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius05_02'),1000); + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button01.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0240 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0270 + * @tc.name Verify that in the api18 environment, the default style of the buttons of timePickerDialog is ROUNDED_RECTANGLE and displayed normally + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0270', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0270 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius06") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius06_01'),1000); + let button02: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius06_02'),1000); + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button02.click() + windowSnap.snapShot() + await driver.mouseClick({x:200,y:900},MouseButton.MOUSE_BUTTON_LEFT) + await driver.waitForIdle(500,2000) + await button01.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0270 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0260 + * @tc.name Verify that in the api18 environment, the default style of the buttons of TextPickerDialog is ROUNDED_RECTANGLE and displayed normally + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0260', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0260 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius08") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius08_01'),1000); + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button01.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0260 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0220 + * @tc.name Verify that in the API 18 environment, the default style of the button of bindpopup is ROUNDED_RECTANGLE and displayed normally + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0220', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0220 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius09") + let driver:Driver=Driver.create(); + let button01: Component = await driver.waitForComponent(ON.id('UiComponentButtonButtonRadius09_01'),1000); + windowSnap.snapShot() + await driver.waitForIdle(500,2000) + await button01.click() + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0220 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0230 + * @tc.name Verify that in the API 18 environment, the default style of the button is ROUNDED_RECTANGLE and displayed normally + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 0 + */ + it('SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0230', Level.LEVEL0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0230 start.`); + Settings.createWindow("testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius10") + let driver:Driver=Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_BUTTON_BUTTON_RADIUS_0230 finish.`); + done() + }) + + }) +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit01.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit01.ets new file mode 100644 index 0000000000000000000000000000000000000000..0447fd41a0977bde59dada0b05492a1b0d364d5f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit01.ets @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit01 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to zh-Hans and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit01_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit01_02') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + this.text = JSON.stringify(value) + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit02.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit02.ets new file mode 100644 index 0000000000000000000000000000000000000000..f130dd50d76370dc9312d3903db71a9f5d7f586d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit02.ets @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit02 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to zh-Hans-TW and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hant-TW") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit02_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-TW'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant-HK") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit02_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-HK'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit02_03') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + this.text = JSON.stringify(value) + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit03.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit03.ets new file mode 100644 index 0000000000000000000000000000000000000000..39fd39f42a17a07e05d4e47d7592c9edb985d90e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit03.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit03 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to zh-Hans and see textstyle' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('30%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit03_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit03_02') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit04.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit04.ets new file mode 100644 index 0000000000000000000000000000000000000000..024e0dbe420cef1cb86fc31c8f356126c2820dbb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit04.ets @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit04 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to zh-Hans-TW and check textstyle' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hant-TW") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit04_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-TW'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant-HK") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit04_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-HK'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit04_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit05.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit05.ets new file mode 100644 index 0000000000000000000000000000000000000000..d398b8312c85858be15c67a63b9ee38c28d71e7d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit05.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit05 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to zh-Hans and check onChange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('30%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit05_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit05_02') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit06.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit06.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e4fdf7b77da703329a80b80b152342753d2815d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit06.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit06 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to zh-Hans-TW and check onChange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + .id('ArkuiSpecialComponentsDialogCalenDarHabit06_04') + Button("setAppPreferredLanguage zh-Hant-TW") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit06_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-TW'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant-HK") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit06_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-HK'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit06_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit07.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit07.ets new file mode 100644 index 0000000000000000000000000000000000000000..02a257e0c2c84f2ec62cd0d38af984c882157e6b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit07.ets @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit07 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to ug and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage ug") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit07_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('ug'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit07_02') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + this.text = JSON.stringify(value) + this.selectedDate = value; + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit08.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit08.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb7c4e37cfb29cd032e9a394ae11f6f783736999 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit08.ets @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit08 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to ug and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .id('ArkuiSpecialComponentsDialogCalenDarHabit08_04') + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + Button("setAppPreferredLanguage ug") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit08_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('ug'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit08_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit08_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit09.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit09.ets new file mode 100644 index 0000000000000000000000000000000000000000..25331f92821941827e533cba03ff93ffde47aea1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit09.ets @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit09 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to ug and check textstyle' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .id('ArkuiSpecialComponentsDialogCalenDarHabit09_04') + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + Button("setAppPreferredLanguage ug") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit09_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('ug'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit09_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit09_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit10.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit10.ets new file mode 100644 index 0000000000000000000000000000000000000000..38fbe09cdb738baf567c2497b9283042f79849df --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit10.ets @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit10 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to zh-Hans-TW and check onAccept' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage zh-Hant-TW") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit10_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-TW'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant-HK") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit10_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant-HK'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit10_03') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.text = JSON.stringify(value) + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit11.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit11.ets new file mode 100644 index 0000000000000000000000000000000000000000..250633da943c57e3e6812cfa7ddbe769a27a94e8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit11.ets @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit11 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to en and check onAccept' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .id('ArkuiSpecialComponentsDialogCalenDarHabit11_04') + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage en") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit11_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('en'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit11_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit11_03') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.text = JSON.stringify(value) + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit12.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit12.ets new file mode 100644 index 0000000000000000000000000000000000000000..66cf5966800a6dda7ee476437a27cb8fc3fb52df --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit12.ets @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit12 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to en and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .id('ArkuiSpecialComponentsDialogCalenDarHabit12_04') + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage en") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit12_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('en'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hant") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit12_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hant'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit12_03') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + this.text = JSON.stringify(value) + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit13.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit13.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c3050645ec5be18b34cdae557f5aa8c9967f1bd --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit13.ets @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit13 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to en and see textstyle' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('30%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage en") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit13_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('en'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit13_03') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit13_02') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit14.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit14.ets new file mode 100644 index 0000000000000000000000000000000000000000..23f1b7249268f10ac40a393a579a0008b97c4f95 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit14.ets @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit14 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to bo-CN and see textstyle' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('30%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage bo-CN") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit14_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('bo-CN'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit14_03') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit14_02') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit15.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit15.ets new file mode 100644 index 0000000000000000000000000000000000000000..be7ce7463af5ebb1b327bae3433098285d07f5df --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit15.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit15 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to en and check onChange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('15%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit15_04') + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage en") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit15_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('en'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit15_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit15_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit16.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit16.ets new file mode 100644 index 0000000000000000000000000000000000000000..039cbe5e24d4a7b669a41e108e02917c254bd9e6 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit16.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit16 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPicker set language to bo-CN and check onChange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('15%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit16_04') + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .borderWidth(1) + Button("setAppPreferredLanguage bo-CN") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit16_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('bo-CN'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("setAppPreferredLanguage zh-Hans") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit16_02') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('zh-Hans'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Text('月历日期选择器') + .fontSize(20) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + .edgeAlign(CalendarAlign.END) + .id('ArkuiSpecialComponentsDialogCalenDarHabit16_03') + .textStyle( + { + color: Color.Red, + font: { + size: 20, + weight: FontWeight.Normal + } + }) + .margin(10) + .onChange((value) => { + this.text = JSON.stringify(value) + console.info("CalendarPicker onChange:" + JSON.stringify(value)) + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit17.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit17.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1f497d5af9ea5752d72bee3cc4a5643dce7190 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/ArkuiSpecialComponentsDialogCalenDarHabit/ArkuiSpecialComponentsDialogCalenDarHabit17.ets @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct ArkuiSpecialComponentsDialogCalenDarHabit17 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set language to bo-CN and check onchange' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + Button("setAppPreferredLanguage bo-CN") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit17_01') + .type(ButtonType.Capsule) + .width('80%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .onClick(()=>{ + try { + i18n.System.setAppPreferredLanguage('bo-CN'); + console.log("setAppPreferredLanguage success") + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + }) + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('ArkuiSpecialComponentsDialogCalenDarHabit17_02') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + borderRadius: 20 + }, + cancelButtonStyle: { + type: ButtonType.Normal, + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + borderRadius: 10 + }, + onAccept: (value) => { + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + this.text = JSON.stringify(value) + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius01.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius01.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e91529877e87367380c2ea81c4cf9d19ff491b0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius01.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentButtonButtonRadius01 { + @State text: string = 'button set borderRadius to 30px'; + @State widthShortSize: number = 200; + @State count : number = 0 + + build() { + Row() { + Column() { + Text(this.text+'click count:'+this.count) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + + Button('NORMAL') + .width(this.widthShortSize) + .type(ButtonType.Normal) + .stateEffect(true) + .id('UiComponentButtonButtonRadius01_01') + .controlSize(ControlSize.NORMAL) + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("onclick success") + }) + .borderRadius('30px') + .buttonStyle(ButtonStyleMode.NORMAL) + .fontColor(Color.Red) + .fontSize(40) + + Button('EMPHASIZED', { type: ButtonType.Normal, stateEffect: true }) + .width(this.widthShortSize) + .stateEffect(true) + .type(ButtonType.Normal) + .controlSize(ControlSize.NORMAL) + .id('UiComponentButtonButtonRadius01_02') + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("onclick success") + }) + .borderRadius('30px') + .buttonStyle(ButtonStyleMode.EMPHASIZED) + .fontColor(Color.Red) + .fontSize(40) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius02.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius02.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f46f3c983a642b19de92234fd85f52d9d31d4f1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius02.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentButtonButtonRadius02 { + @State text: string = 'button set borderRadius to 30%'; + @State widthShortSize: number = 200; + @State count : number = 0 + + build() { + Row() { + Column() { + Text(this.text+'click count:'+this.count) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + + Button('NORMAL') + .width(this.widthShortSize) + .type(ButtonType.Normal) + .stateEffect(true) + .id('UiComponentButtonButtonRadius02_01') + .controlSize(ControlSize.NORMAL) + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("NORMAL onclick success") + }) + .borderRadius('30%') + .buttonStyle(ButtonStyleMode.NORMAL) + .fontColor(Color.Red) + .fontSize(40) + + Button('EMPHASIZED', { type: ButtonType.Normal, stateEffect: true }) + .width(this.widthShortSize) + .stateEffect(true) + .type(ButtonType.Normal) + .controlSize(ControlSize.NORMAL) + .id('UiComponentButtonButtonRadius02_02') + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("EMPHASIZED onclick success") + }) + .borderRadius('30%') + .buttonStyle(ButtonStyleMode.EMPHASIZED) + .fontColor(Color.Red) + .fontSize(40) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius03.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius03.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9cadca4ef9d25d47481726191ba293746202dff --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius03.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentButtonButtonRadius03 { + @State text: string = 'button set borderRadius to 10vp'; + @State widthShortSize: number = 200; + @State count : number = 0 + + build() { + Row() { + Column() { + Text(this.text+'click count:'+this.count) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:20, + left:1, + right:1 + }) + .padding(20) + .borderWidth(1) + + Button('NORMAL') + .width(this.widthShortSize) + .type(ButtonType.Normal) + .stateEffect(true) + .id('UiComponentButtonButtonRadius03_01') + .controlSize(ControlSize.NORMAL) + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("NORMAL onclick success") + }) + .borderRadius(10) + .buttonStyle(ButtonStyleMode.NORMAL) + .fontColor(Color.Red) + .fontSize(40) + + Button('EMPHASIZED', { type: ButtonType.Normal, stateEffect: true }) + .width(this.widthShortSize) + .stateEffect(true) + .type(ButtonType.Normal) + .controlSize(ControlSize.NORMAL) + .id('UiComponentButtonButtonRadius03_02') + .height(100) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(()=>{ + this.count++; + console.log("EMPHASIZED onclick success") + }) + .borderRadius(10) + .buttonStyle(ButtonStyleMode.EMPHASIZED) + .fontColor(Color.Red) + .fontSize(40) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius04.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius04.ets new file mode 100644 index 0000000000000000000000000000000000000000..17d138957d48b117596cada9266b612fc121d610 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius04.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentButtonButtonRadius04 { + @State text: string = 'button set buttonStyle to NORMAL and TEXTUAL'; + @State widthShortSize: number = 200; + @State count: number = 0; + + @Styles + commonButtonStyle() { + .width(this.widthShortSize) + .height(100) + .onClick(() => { + this.count++; + console.log('Button onclick success'); + }) + } + + build() { + Row() { + Column() { + Text(`${this.text} click count: ${this.count}`) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(10) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ type: TextDecorationType.Underline, color: Color.Black }) + .margin({ + top: 1, + bottom: 20, + left: 1, + right: 1 + }) + .padding(20) + .borderWidth(1); + + Button('Normal') + .commonButtonStyle() + .id('UiComponentButtonButtonRadius04_01') + .role(ButtonRole.NORMAL) + .margin({ top: 20 }) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + + Button('Textual') + .commonButtonStyle() + .id('UiComponentButtonButtonRadius04_02') + .margin({ top: 20 }) + .buttonStyle(ButtonStyleMode.TEXTUAL) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius05.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius05.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c958fbb405ee1ce803d60763ad9d61bf850677d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius05.ets @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct UiComponentButtonButtonRadius05 { + private selectedDate: Date = new Date(); + @State text : string = 'CalendarPickerDialog set all button type to default' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .id('UiComponentButtonButtonRadius05_01') + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + + Button("Show CalendarPicker Dialog") + .margin(20) + .controlSize(ControlSize.NORMAL) + .id('UiComponentButtonButtonRadius05_02') + .type(ButtonType.Capsule) + .width('50%') + .borderRadius(5) + .height('20%') + .fontWeight(FontWeight.Bolder) + .backgroundColor(Color.Blue) + .onClick(()=>{ + console.log("onclick success") + }) + .labelStyle({ overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 2, + maxFontSize: 20, + font: { + size: 10, + weight: FontWeight.Bolder, + family: 'cursive', + style: FontStyle.Italic + } + }) + .fontSize(2) + .onClick(() => { + console.info("CalendarDialog.show"); + CalendarPickerDialog.show({ + selected: this.selectedDate, + acceptButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + }, + cancelButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + }, + onAccept: (value) => { + this.text = JSON.stringify(value) + this.selectedDate = value; + console.info("calendar onAccept:" + JSON.stringify(value)); + }, + onCancel: () => { + console.info("calendar onCancel"); + }, + onChange: (value) => { + console.info("calendar onChange:" + JSON.stringify(value)); + }, + onDidAppear: () => { + console.info("calendar onDidAppear"); + }, + onDidDisappear: () => { + console.info("calendar onDidDisappear"); + }, + onWillAppear: () => { + console.info("calendar onWillAppear"); + }, + onWillDisappear: () => { + console.info("calendar onWillDisappear"); + } + }); + }) + } + .width('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius06.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius06.ets new file mode 100644 index 0000000000000000000000000000000000000000..84aea9910a256d9242f498c6922fc2d840fd12f6 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius06.ets @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct UiComponentButtonButtonRadius06 { + private selectedDate: Date = new Date(); + private selectTime: Date = new Date('2025-8-25T08:30:00') + @State text : string = 'TimePickerDialog set all button type to default' + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + + Button("TimePickerDialog 12小时制") + .margin(20) + .id('UiComponentButtonButtonRadius06_01') + .onClick(() => { + TimePickerDialog.show({ + selected: this.selectTime, + acceptButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + }, + cancelButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + }, + disappearTextStyle: { color: Color.Red, font: { size: 15, weight: FontWeight.Lighter } }, + textStyle: { color: Color.Black, font: { size: 20, weight: FontWeight.Normal } }, + selectedTextStyle: { color: Color.Blue, font: { size: 30, weight: FontWeight.Bolder } }, + onAccept: (value: TimePickerResult) => { + if (value.hour != undefined && value.minute != undefined) { + this.selectTime.setHours(value.hour, value.minute) + console.info("TimePickerDialog:onAccept()" + JSON.stringify(value)) + } + }, + onCancel: () => { + console.info("TimePickerDialog:onCancel()") + }, + onChange: (value: TimePickerResult) => { + console.info("TimePickerDialog:onChange()" + JSON.stringify(value)) + }, + onDidAppear: () => { + console.info("TimePickerDialog:onDidAppear()") + }, + onDidDisappear: () => { + console.info("TimePickerDialog:onDidDisappear()") + }, + onWillAppear: () => { + console.info("TimePickerDialog:onWillAppear()") + }, + onWillDisappear: () => { + console.info("TimePickerDialog:onWillDisappear()") + } + }) + }) + + Button("TimePickerDialog 24小时制") + .margin(20) + .id('UiComponentButtonButtonRadius06_02') + .onClick(() => { + TimePickerDialog.show({ + selected: this.selectTime, + useMilitaryTime: true, + acceptButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + }, + cancelButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + }, + disappearTextStyle: { color: Color.Red, font: { size: 15, weight: FontWeight.Lighter } }, + textStyle: { color: Color.Black, font: { size: 20, weight: FontWeight.Normal } }, + selectedTextStyle: { color: Color.Blue, font: { size: 30, weight: FontWeight.Bolder } }, + onAccept: (value: TimePickerResult) => { + if (value.hour != undefined && value.minute != undefined) { + this.selectTime.setHours(value.hour, value.minute) + console.info("TimePickerDialog:onAccept()" + JSON.stringify(value)) + } + }, + onCancel: () => { + console.info("TimePickerDialog:onCancel()") + }, + onChange: (value: TimePickerResult) => { + console.info("TimePickerDialog:onChange()" + JSON.stringify(value)) + }, + onDidAppear: () => { + console.info("TimePickerDialog:onDidAppear()") + }, + onDidDisappear: () => { + console.info("TimePickerDialog:onDidDisappear()") + }, + onWillAppear: () => { + console.info("TimePickerDialog:onWillAppear()") + }, + onWillDisappear: () => { + console.info("TimePickerDialog:onWillDisappear()") + } + }) + }) + } + .width('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius08.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius08.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e128106aee901baef57d0b1e942f429dab7dc99 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius08.ets @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct UiComponentButtonButtonRadius08 { + private selectedDate: Date = new Date(); + private selectTime: Date = new Date('2025-8-25T08:30:00') + @State text : string = 'TextPickerDialog set all button type to default' + private select: number | number[] = 0 + private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5'] + @State v:string = ''; + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + + Button("TextPickerDialog:" + this.v) + .id('UiComponentButtonButtonRadius08_01') + .margin(20) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(() => { + this.getUIContext().showTextPickerDialog({ + range: this.fruits, + selected: this.select, + disappearTextStyle: {color: Color.Red, font: {size: 15, weight: FontWeight.Lighter}}, + textStyle: {color: Color.Black, font: {size: 20, weight: FontWeight.Normal}}, + selectedTextStyle: {color: Color.Blue, font: {size: 30, weight: FontWeight.Bolder}}, + acceptButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: 'rgb(81, 81, 216)', + fontSize: '26fp', + fontWeight: FontWeight.Bolder, + fontStyle: FontStyle.Normal, + fontFamily: 'sans-serif', + backgroundColor: '#A6ACAF', + }, + cancelButtonStyle: { + style: ButtonStyleMode.NORMAL, + role: ButtonRole.NORMAL, + fontColor: Color.Blue, + fontSize: '16fp', + fontWeight: FontWeight.Normal, + fontStyle: FontStyle.Italic, + fontFamily: 'sans-serif', + backgroundColor: '#50182431', + }, + onAccept: (value: TextPickerResult) => { + this.select = value.index + console.log(this.select + '') + this.v = value.value as string + console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TextPickerDialog:onCancel()") + }, + onChange: (value: TextPickerResult) => { + console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) + }, + onScrollStop: (value: TextPickerResult) => { + console.info("TextPickerDialog:onScrollStop()" + JSON.stringify(value)) + }, + onDidAppear: () => { + console.info("TextPickerDialog:onDidAppear()") + }, + onDidDisappear: () => { + console.info("TextPickerDialog:onDidDisappear()") + }, + onWillAppear: () => { + console.info("TextPickerDialog:onWillAppear()") + }, + onWillDisappear: () => { + console.info("TextPickerDialog:onWillDisappear()") + } + }) + }) + } + .width('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius09.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius09.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c0edf13bdd65a8963cb2b6ff07eccff3077d2a3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius09.ets @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct UiComponentButtonButtonRadius09 { + private selectedDate: Date = new Date(); + private selectTime: Date = new Date('2025-8-25T08:30:00') + @State text : string = 'PopupOptions set all button type to default' + @State handlePopup: boolean = false; + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + + Button('PopupOptions') + .id('UiComponentButtonButtonRadius09_01') + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(() => { + this.handlePopup = true; + }) + .bindPopup(this.handlePopup, { + message: 'This is a popup with PopupOptions', + messageOptions: { + textColor: Color.Red, + font: { + size: '14vp', + style: FontStyle.Italic, + weight: FontWeight.Bolder + } + }, + placement: Placement.Bottom, + enableArrow: false, + targetSpace: '15vp', + onStateChange: (e) => { + if (!e.isVisible) { + this.handlePopup = false; + } + }, + onWillDismiss: ( + (dismissPopupAction: DismissPopupAction) => { + console.info("dismissReason:" + JSON.stringify(dismissPopupAction.reason)); + if (dismissPopupAction.reason === DismissReason.PRESS_BACK) { + dismissPopupAction.dismiss(); + } + } + ) + }) + } + .width('100%') + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius10.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius10.ets new file mode 100644 index 0000000000000000000000000000000000000000..a28d99ea39594bd649772b1e87392da1121f9d00 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentButtonButtonRadius/UiComponentButtonButtonRadius10.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { i18n } from '@kit.LocalizationKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct UiComponentButtonButtonRadius10 { + private selectedDate: Date = new Date(); + private selectTime: Date = new Date('2025-8-25T08:30:00') + @State text : string = 'Button set all button type to default' + @State handlePopup: boolean = false; + @State widthShortSize: number = 205; + + build() { + Column() { + Text(this.text) + .width('80%') + .height('20%') + .padding(3) + .ellipsisMode(EllipsisMode.END) + .fontSize(5) + .maxLines(3) + .wordBreak(WordBreak.NORMAL) + .textCase(TextCase.Normal) + .draggable(true) + .copyOption(CopyOptions.InApp) + .fontColor(Color.Red) + .lineHeight(20) + .fontWeight(FontWeight.Bolder) + .textAlign(TextAlign.Center) + .decoration({ + type: TextDecorationType.Underline, + color:Color.Black + }) + .margin({ + top:1, + bottom:1, + left:1, + right:1 + }) + .borderWidth(1) + + Button('Button') + .id('UiComponentButtonButtonRadius10_01') + .width(this.widthShortSize) + .height(100) + .backgroundColor(0x317aff) + .labelStyle({ + overflow: TextOverflow.Clip, + maxLines: 1, + minFontSize: 20, + maxFontSize: 20, + font: { + size: 20, + weight: 900, + family: 'cursive', + style: FontStyle.Italic, + } + }) + .onClick(() => { + this.handlePopup = true; + }) + } + .width('100%') + } +} \ No newline at end of file