diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/list_scrollbar_hover/ListScrollbarHover.test.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/list_scrollbar_hover/ListScrollbarHover.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa0fc59f17d7d337660b614eb42ab900ce064a38 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/list_scrollbar_hover/ListScrollbarHover.test.ets @@ -0,0 +1,374 @@ +/** + * 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 { 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 } from '@kit.TestKit'; +import { BusinessError } from '@kit.BasicServicesKit' + +export default function ListScrollbarHoverTest () { + + describe('ListScrollbarHoverTest', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return + } + + Settings.windowClass.destroyWindow((err:BusinessError) => { + 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_LIST_SACROLLBAR_HOVER_0030 + * @tc.name : List scrollbar hover test - change color + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0030', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0030 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover01") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0030')); + await windowSnap.snapShot('ListScrollbarHover0030_1'); + await Utils.sleep(1000); + + // 点击改变滚动条颜色按钮 + let colorButton: Component = await driver.waitForComponent(ON.id('change_color_button_03'), 1000); + await colorButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0030_2'); + await Utils.sleep(1000); + + // 再次点击改变颜色 + await colorButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0030_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0030 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0050 + * @tc.name : List scrollbar hover test - change layout direction + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0050', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0050 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover02") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0050')); + await windowSnap.snapShot('ListScrollbarHover0050_1'); + await Utils.sleep(1000); + + // 点击改变布局方向按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_05'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0050_2'); + await Utils.sleep(1000); + + // 再次点击改变方向 + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0050_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0050 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0100 + * @tc.name : List scrollbar hover test - Image component state change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0100', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0100 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover03") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0100')); + await windowSnap.snapShot('ListScrollbarHover0100_1'); + await Utils.sleep(1000); + + // 点击改变滚动条状态按钮 + let stateButton: Component = await driver.waitForComponent(ON.id('change_state_button_10'), 1000); + await stateButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0100_2'); + await Utils.sleep(1000); + + // 再次点击改变状态 + await stateButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0100_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0100 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0040 + * @tc.name : List scrollbar hover test - change width + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0040', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0040 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover04") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0040')); + await windowSnap.snapShot('ListScrollbarHover0040_1'); + await Utils.sleep(1000); + + // 点击改变滚动条宽度按钮 + let widthButton: Component = await driver.waitForComponent(ON.id('change_width_button_04'), 1000); + await widthButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0040_2'); + await Utils.sleep(1000); + + // 再次点击改变宽度 + await widthButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0040_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0040 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0060 + * @tc.name : List scrollbar hover test - change direction + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0060', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0060 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover05") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0060')); + await windowSnap.snapShot('ListScrollbarHover0060_1'); + await Utils.sleep(1000); + + // 点击改变direction按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_06'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0060_2'); + await Utils.sleep(1000); + + // 再次点击改变direction + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0060_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0060 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0080 + * @tc.name : List scrollbar hover test - Text component state change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0080', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0080 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover06") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0080')); + await windowSnap.snapShot('ListScrollbarHover0080_1'); + await Utils.sleep(1000); + + // 点击改变滚动条状态按钮 + let stateButton: Component = await driver.waitForComponent(ON.id('change_state_button_08'), 1000); + await stateButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0080_2'); + await Utils.sleep(1000); + + // 再次点击改变状态 + await stateButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0080_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0080 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0130 + * @tc.name : List scrollbar hover test - Text component direction change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0130', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0130 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover07") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0130')); + await windowSnap.snapShot('ListScrollbarHover0130_1'); + await Utils.sleep(1000); + + // 点击改变direction按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_13'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0130_2'); + await Utils.sleep(1000); + + // 再次点击改变direction + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0130_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0130 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0110 + * @tc.name : List scrollbar hover test - Text component layout direction change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0110', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0110 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover08") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0110')); + await windowSnap.snapShot('ListScrollbarHover0110_1'); + await Utils.sleep(1000); + + // 点击改变布局方向按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_11'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0110_2'); + await Utils.sleep(1000); + + // 再次点击改变方向 + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0110_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0110 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0120 + * @tc.name : List scrollbar hover test - Image component layout direction change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0120', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0120 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover09") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0120')); + await windowSnap.snapShot('ListScrollbarHover0120_1'); + await Utils.sleep(1000); + + // 点击改变布局方向按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_12'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0120_2'); + await Utils.sleep(1000); + + // 再次点击改变方向 + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0120_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0120 end'); + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0140 + * @tc.name : List scrollbar hover test - Image component direction change + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0140', Level.LEVEL3, async (done: Function) => { + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0140 start'); + Settings.createWindow("testability/pages/list_scrollbar_hover/listScrollbarHover10") + let driver: Driver = Driver.create(); + await driver.waitForIdle(200, 500); + await driver.assertComponentExist(ON.text('List滚动条悬浮测试0140')); + await windowSnap.snapShot('ListScrollbarHover0140_1'); + await Utils.sleep(1000); + + // 点击改变direction按钮 + let directionButton: Component = await driver.waitForComponent(ON.id('change_direction_button_14'), 1000); + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0140_2'); + await Utils.sleep(1000); + + // 再次点击改变direction + await directionButton.click(); + await driver.waitForIdle(500, 2000); + await windowSnap.snapShot('ListScrollbarHover0140_3'); + await Utils.sleep(1000); + + console.log('SUB_ACE_UI_COMPONENT_LIST_SACROLLBAR_HOVER_0140 end'); + done(); + }); + + }) +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/textPicker_wear/TextPickerWear.test.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/textPicker_wear/TextPickerWear.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2904cbc32f8842352af308d0ecbe5fc445efd75 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/textPicker_wear/TextPickerWear.test.ets @@ -0,0 +1,870 @@ +/** + * 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 { 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 } from '@kit.TestKit'; +import { BusinessError } from '@kit.BasicServicesKit' + +export default function TextPickerWearTest() { + describe('TextPickerWearTest', () => { + beforeAll(() => { + console.info('TextPickerWearTest beforeAll'); + }); + + beforeEach(() => { + console.info('TextPickerWearTest beforeEach'); + }); + + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return + } + + Settings.windowClass.destroyWindow((err:BusinessError) => { + 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() + }) + + afterAll(() => { + console.info('TextPickerWearTest afterAll'); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0450 + * @tc.name : TextPicker wearable single column focus display test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0450', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear01"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker更改选中项观察焦点显示 + let textPicker: Component = await driver.waitForComponent(ON.id('text_picker_01'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项字体,颜色等 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0450'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0440 + * @tc.name : TextPicker wearable single column scroll up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0440', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear02"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向上滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.8; + let endY = rect.top + height * 0.2; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0440'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0400 + * @tc.name : TextPicker wearable single column fling up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0400', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear03"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向上抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY - 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0400'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0380 + * @tc.name : TextPicker wearable multi column click upper option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0380', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear04"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker点击上面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0380'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0430 + * @tc.name : TextPicker wearable single column fling down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0430', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear05"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向下抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向下抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY + 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0430'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0370 + * @tc.name : TextPicker wearable multi column scroll up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0370', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear06"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向上滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用swipe方法模拟向上滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.8; + let endY = rect.top + height * 0.2; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0370'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0460 + * @tc.name : TextPicker wearable single column fling up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0460', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear07"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向上抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY - 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0460'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0390 + * @tc.name : TextPicker wearable multi column click lower option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0390', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear08"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker点击下面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0390'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0510 + * @tc.name : TextPicker wearable multi column click lower option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0510', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear09"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker点击下面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0510'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0490 + * @tc.name : TextPicker wearable single column click lower option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0490', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear10"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker点击下面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0490'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0520 + * @tc.name : TextPicker wearable multi column scroll down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0520', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear11"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向下滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用swipe方法模拟向下滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.2; + let endY = rect.top + height * 0.8; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0520'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0470 + * @tc.name : TextPicker wearable single column fling down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0470', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear12"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向下抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向下抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY + 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0470'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0550 + * @tc.name : TextPicker wearable multi column fling down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0550', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear13"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向下抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用正确的fling方法,从中心点向下抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY + 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0550'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0530 + * @tc.name : TextPicker wearable multi column click upper option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0530', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear14"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker点击上面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0530'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0540 + * @tc.name : TextPicker wearable single column focus display test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0540', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear15"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker更改选中项观察焦点显示 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项字体,颜色等 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0540'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0570 + * @tc.name : TextPicker wearable single column click upper option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0570', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear16"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker点击上面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0570'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0560 + * @tc.name : TextPicker wearable single column fling up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0560', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear17"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向上抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY - 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0560'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0630 + * @tc.name : TextPicker wearable single column click upper option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0630', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear18"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker点击上面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0630'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0640 + * @tc.name : TextPicker wearable multi column scroll down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0640', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear19"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向下滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用swipe方法模拟向下滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.2; + let endY = rect.top + height * 0.8; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0640'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0580 + * @tc.name : TextPicker wearable multi column multi finger operation test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0580', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear20"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker多指操作同时滑动多列 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0580'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0620 + * @tc.name : TextPicker wearable single column drag up down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0620', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear21"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上/向下拖动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向上拖动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.6; + let endY = rect.top + height * 0.4; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + // 使用swipe方法模拟向下拖动 + await driver.swipe(centerX, endY, centerX, startY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0620'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0610 + * @tc.name : TextPicker wearable single column scroll down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0610', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear22"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向下滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向下滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.2; + let endY = rect.top + height * 0.8; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0610'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0600 + * @tc.name : TextPicker wearable single column fling down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0600', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear23"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向下抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用正确的fling方法,从中心点向下抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY + 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0600'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0660 + * @tc.name : TextPicker wearable single column drag up down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0660', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear24"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上/向下拖动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向上拖动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.6; + let endY = rect.top + height * 0.4; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + // 使用swipe方法模拟向下拖动 + await driver.swipe(centerX, endY, centerX, startY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0660'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0650 + * @tc.name : TextPicker wearable multi column fling up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0650', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear25"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向上抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用正确的fling方法,从中心点向上抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY - 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0650'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0680 + * @tc.name : TextPicker wearable multi column fling up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0680', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear26"); + await driver.waitForIdle(500, 2000); + + // 1、多列TextPicker向上抛滑 + let textPicker: Component = await driver.waitForComponent(ON.id('multi_text_picker'), 1000); + // 使用正确的fling方法,从中心点向上抛滑 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let centerY = rect.top + (rect.bottom - rect.top) / 2; + await driver.fling({x: centerX, y: centerY}, {x: centerX, y: centerY - 200}, 5, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0680'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0670 + * @tc.name : TextPicker wearable single column click lower option test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0670', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear27"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker点击下面备选项 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0670'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0720 + * @tc.name : TextPicker wearable single column focus display test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0720', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear28"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker更改选中项观察焦点显示 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + await textPicker.click(); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项字体,颜色等 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0720'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0700 + * @tc.name : TextPicker wearable single column scroll up test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0700', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear29"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向上滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向上滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.8; + let endY = rect.top + height * 0.2; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0700'); + await Utils.sleep(1000); + + done(); + }); + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0710 + * @tc.name : TextPicker wearable single column scroll down test + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0710', Level.LEVEL3, async (done: Function) => { + let driver: Driver = Driver.create(); + Settings.createWindow("testability/pages/textPicker_wear/textPickerWear30"); + await driver.waitForIdle(500, 2000); + + // 1、单列TextPicker向下滑动 + let textPicker: Component = await driver.waitForComponent(ON.id('single_text_picker'), 1000); + // 使用swipe方法模拟向下滑动 + let rect = await textPicker.getBounds(); + let centerX = rect.left + (rect.right - rect.left) / 2; + let height = rect.bottom - rect.top; + let startY = rect.top + height * 0.2; + let endY = rect.top + height * 0.8; + await driver.swipe(centerX, startY, centerX, endY, 1000); + await driver.waitForIdle(500, 2000); + + // 2、观察选中项变化 + await windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PICKER_WEAR_0710'); + await Utils.sleep(1000); + + done(); + }); + }); +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover01.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover01.ets new file mode 100644 index 0000000000000000000000000000000000000000..4741d68c0e89e9dafe78cba047dca9cf23c55e2c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover01.ets @@ -0,0 +1,94 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover01 { + @State scrollBarColor: string | number | Color = Color.Blue; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0030') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('滚动条状态: Auto, 动态改变滚动条颜色') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前颜色: ${this.scrollBarColor}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变滚动条颜色') + .id('change_color_button_03') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + if (this.scrollBarColor === Color.Blue) { + this.scrollBarColor = Color.Red; + } else if (this.scrollBarColor === Color.Red) { + this.scrollBarColor = Color.Green; + } else { + this.scrollBarColor = Color.Blue; + } + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .scrollBarColor(this.scrollBarColor) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover02.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover02.ets new file mode 100644 index 0000000000000000000000000000000000000000..36b7cc7f8707c4ebbcaf68972e972783b6e4860d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover02.ets @@ -0,0 +1,89 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover02 { + @State listDirection: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0050') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('滚动条状态: Auto, 动态改变布局方向') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listDirection === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变布局方向') + .id('change_direction_button_05') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listDirection = this.listDirection === Axis.Vertical ? + Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listDirection) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover03.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover03.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9813a717b9107fcc22ff2628975d190f34957e3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover03.ets @@ -0,0 +1,110 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover03 { + @State scrollBarState: BarState = BarState.Auto; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0100') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Image, 滚动条状态异常值与正常值切换') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前滚动条状态: ${this.getScrollBarStateText()}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变滚动条状态') + .id('change_state_button_10') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + if (this.scrollBarState === BarState.Auto) { + this.scrollBarState = BarState.On; + } else if (this.scrollBarState === BarState.On) { + this.scrollBarState = BarState.Off; + } else { + this.scrollBarState = BarState.Auto; + } + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Image($r('app.media.icon')) + .width(40) + .height(40) + .margin({ right: 10 }) + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(this.scrollBarState) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } + + private getScrollBarStateText(): string { + switch (this.scrollBarState) { + case BarState.Auto: + return 'Auto'; + case BarState.On: + return 'On'; + case BarState.Off: + return 'Off'; + default: + return 'Unknown'; + } + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover04.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover04.ets new file mode 100644 index 0000000000000000000000000000000000000000..52cd85dd02e6c13d5ecfb2ddcd9b672e0b19ae4c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover04.ets @@ -0,0 +1,94 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover04 { + @State scrollBarWidth: number = 8; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0040') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('滚动条状态: Auto, 动态改变滚动条宽度') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前滚动条宽度: ${this.scrollBarWidth}px`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变滚动条宽度') + .id('change_width_button_04') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + if (this.scrollBarWidth === 8) { + this.scrollBarWidth = 12; + } else if (this.scrollBarWidth === 12) { + this.scrollBarWidth = 16; + } else { + this.scrollBarWidth = 8; + } + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .scrollBarWidth(this.scrollBarWidth) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover05.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover05.ets new file mode 100644 index 0000000000000000000000000000000000000000..a960ccfd1095c536a28d6714fa377956b24e5d09 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover05.ets @@ -0,0 +1,88 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover05 { + @State listAxis: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0060') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('滚动条状态: Auto, 改变direction') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listAxis === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变direction') + .id('change_direction_button_06') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listAxis = this.listAxis === Axis.Vertical ? Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listAxis) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover06.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover06.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b7ac0de4278d2c2a4d336d58970a97552362e31 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover06.ets @@ -0,0 +1,107 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover06 { + @State scrollBarState: BarState = BarState.Auto; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0080') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Text, 滚动条状态异常值与正常值切换') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前滚动条状态: ${this.getScrollBarStateText()}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变滚动条状态') + .id('change_state_button_08') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + if (this.scrollBarState === BarState.Auto) { + this.scrollBarState = BarState.On; + } else if (this.scrollBarState === BarState.On) { + this.scrollBarState = BarState.Off; + } else { + this.scrollBarState = BarState.Auto; + } + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + .fontWeight(FontWeight.Bold) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(this.scrollBarState) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } + + private getScrollBarStateText(): string { + switch (this.scrollBarState) { + case BarState.Auto: + return 'Auto'; + case BarState.On: + return 'On'; + case BarState.Off: + return 'Off'; + default: + return 'Unknown'; + } + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover07.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover07.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef9fbd904edbf13d3acac9502312142a5f5f7a14 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover07.ets @@ -0,0 +1,89 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover07 { + @State listAxis: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0130') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Text, 滚动条状态: Auto, 改变direction') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listAxis === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变direction') + .id('change_direction_button_13') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listAxis = this.listAxis === Axis.Vertical ? Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + .fontWeight(FontWeight.Bold) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listAxis) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover08.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover08.ets new file mode 100644 index 0000000000000000000000000000000000000000..885f2cf3314da0945f380683167ad1fbfdedde0e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover08.ets @@ -0,0 +1,90 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover08 { + @State listDirection: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0110') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Text, 动态改变布局方向') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listDirection === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变布局方向') + .id('change_direction_button_11') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listDirection = this.listDirection === Axis.Vertical ? + Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Text(item) + .fontSize(16) + .fontColor(Color.Black) + .fontWeight(FontWeight.Bold) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listDirection) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover09.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover09.ets new file mode 100644 index 0000000000000000000000000000000000000000..29f9ece66a257f5dc552f7d49b745a22a50d0e0b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover09.ets @@ -0,0 +1,93 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover09 { + @State listDirection: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0120') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Image, 动态改变布局方向') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listDirection === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变布局方向') + .id('change_direction_button_12') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listDirection = this.listDirection === Axis.Vertical ? + Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Image($r('app.media.icon')) + .width(40) + .height(40) + .margin({ right: 10 }) + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listDirection) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover10.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover10.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bf053024ba8732272985749493a31dcfaa09ff8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/list_scrollbar_hover/listScrollbarHover10.ets @@ -0,0 +1,92 @@ +/** + * 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 { promptAction, LengthMetrics, PromptAction } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct listScrollbarHover10 { + @State listAxis: Axis = Axis.Vertical; + @State currentIndex: number = 0; + private scroller: Scroller = new Scroller(); + private dataArray: string[] = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9', 'Item 10']; + + build() { + Column() { + Text('List滚动条悬浮测试0140') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 10, bottom: 10 }) + + Text('外置滚动条子组件: Image, 滚动条状态: Auto, 改变direction') + .fontSize(16) + .margin({ bottom: 10 }) + + Text(`当前列表方向: ${this.listAxis === Axis.Vertical ? 'Vertical' : 'Horizontal'}`) + .fontSize(14) + .margin({ bottom: 10 }) + + Button('改变direction') + .id('change_direction_button_14') + .type(ButtonType.Capsule) + .height(50) + .onClick(() => { + this.listAxis = this.listAxis === Axis.Vertical ? Axis.Horizontal : Axis.Vertical; + }) + + List({ scroller: this.scroller }) { + ForEach(this.dataArray, (item: string, index: number) => { + ListItem() { + Row() { + Image($r('app.media.icon')) + .width(40) + .height(40) + .margin({ right: 10 }) + Text(item) + .fontSize(16) + .fontColor(Color.Black) + Blank() + Text(`Index: ${index}`) + .fontSize(14) + .fontColor(Color.Gray) + } + .width('100%') + .height(60) + .padding({ left: 20, right: 20 }) + .backgroundColor(index % 2 === 0 ? Color.White : Color.Gray) + .borderRadius(8) + .margin({ bottom: 5 }) + } + }, (item: string) => item) + } + .width('100%') + .height(400) + .scrollBar(BarState.Auto) + .listDirection(this.listAxis) + .onScrollIndex((firstIndex: number) => { + this.currentIndex = firstIndex; + }) + + Text(`当前滚动位置: ${this.currentIndex}`) + .fontSize(14) + .margin({ top: 10 }) + } + .width('100%') + .height('100%') + .backgroundColor(0xF5F5F5) + .padding(20) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear01.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear01.ets new file mode 100644 index 0000000000000000000000000000000000000000..f17d8c167fe5f01ab1b7c04b4fabfdb4b4835669 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear01.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear01 { + @State selectedIndex: number = 2; + private range: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker焦点显示测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.range[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 20 }) + + TextPicker({ + range: this.range, + selected: this.selectedIndex, + value: this.range[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('text_picker_01') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 20, weight: FontWeight.Bold } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 观察选中项的焦点显示效果') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear02.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear02.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5c9d32bc5b8ee4d13f07a648de389032dfa5d80 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear02.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear02 { + @State selectedIndex: number = 5; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向上滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Red, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear03.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear03.ets new file mode 100644 index 0000000000000000000000000000000000000000..28c3b9511b440ec1ce5773c7ec44cd05cb08a315 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear03.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear03 { + @State selectedIndex: number = 3; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向上抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Green, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear04.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear04.ets new file mode 100644 index 0000000000000000000000000000000000000000..38e664a5c9a82b2a78ab8774c166eb1062387e17 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear04.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear04 { + @State selectedIndex: number[] = [2, 1]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker点击上面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Orange, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击上面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear05.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear05.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f639bbefcffdd519fd7e544d05c115855398560 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear05.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear05 { + @State selectedIndex: number = 4; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向下抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear06.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear06.ets new file mode 100644 index 0000000000000000000000000000000000000000..48605705041ba34f5e4891bb819f2c628f30dbdb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear06.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear06 { + @State selectedIndex: number[] = [1, 3]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向上滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Brown, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear07.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear07.ets new file mode 100644 index 0000000000000000000000000000000000000000..736fd728704f38a05cef1c9e52d8daad4f401543 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear07.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear07 { + @State selectedIndex: number = 6; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向上抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Pink, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear08.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear08.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb037f30e3bb37d05ab563d19dbd493bb91bf341 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear08.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear08 { + @State selectedIndex: number[] = [3, 2]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker点击下面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击下面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear09.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear09.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a519bb3c1cd1be365dd1ecfc8e448c961507fa7 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear09.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear09 { + @State selectedIndex: number[] = [4, 1]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker点击下面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Red, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击下面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear10.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear10.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b32b1b9a387aa2001ffca2257e11da21870108e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear10.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear10 { + @State selectedIndex: number = 7; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker点击下面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Yellow, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击下面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear11.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear11.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb1603368fb00a8f70d397bcbf569e8b62024515 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear11.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear11 { + @State selectedIndex: number[] = [2, 4]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向下滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear12.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear12.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd781ccf86d18ef0222cfc96384ec41e537227a7 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear12.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear12 { + @State selectedIndex: number = 8; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向下抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Green, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear13.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear13.ets new file mode 100644 index 0000000000000000000000000000000000000000..18cfe46a2df01ede7a411e4fd3a26b3b42082e93 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear13.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear13 { + @State selectedIndex: number[] = [1, 3]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向下抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Green, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear14.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear14.ets new file mode 100644 index 0000000000000000000000000000000000000000..c293dd404e36cfd9e70da3053f348815fe21df47 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear14.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear14 { + @State selectedIndex: number[] = [4, 2]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker点击上面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Yellow, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击上面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear15.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear15.ets new file mode 100644 index 0000000000000000000000000000000000000000..904dbf534a8b4df3b00ee1ea5570d001a1266091 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear15.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear15 { + @State selectedIndex: number = 9; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker焦点显示测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 20, weight: FontWeight.Bold } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 观察选中项的焦点显示效果') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear16.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear16.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b2f938adde17a3bfd93e4ce74c0f61c4922d024 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear16.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear16 { + @State selectedIndex: number = 0; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker点击上面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Green, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击上面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear17.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear17.ets new file mode 100644 index 0000000000000000000000000000000000000000..283c43b3c2f3c0e726ad80a4ba240aeff68b050d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear17.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear17 { + @State selectedIndex: number = 1; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向上抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Red, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear18.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear18.ets new file mode 100644 index 0000000000000000000000000000000000000000..587f70989fef9bf1c0046df756126f830d5eec75 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear18.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear18 { + @State selectedIndex: number = 2; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker点击上面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Gray, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击上面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear19.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear19.ets new file mode 100644 index 0000000000000000000000000000000000000000..be1b8d826554e741eb433131ccfa57d8cd77c27c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear19.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear19 { + @State selectedIndex: number[] = [3, 1]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向下滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Red, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear20.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear20.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a070754d68aacd8433ad227fc1ba2eddf002ac2 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear20.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear20 { + @State selectedIndex: number[] = [2, 2]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker多指操作测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 多指操作同时滑动多列观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear21.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear21.ets new file mode 100644 index 0000000000000000000000000000000000000000..acb7a41911c58ed0c4e41bd355057d6fe17c05a2 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear21.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear21 { + @State selectedIndex: number = 4; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker拖动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Yellow, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上/向下拖动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear22.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear22.ets new file mode 100644 index 0000000000000000000000000000000000000000..a59b83f9880ccf074532db73a7e22ee90953452f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear22.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear22 { + @State selectedIndex: number = 5; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向下滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.White, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear23.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear23.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1a10fbc33709877fdbeb5067c87a63fa13934aa --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear23.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear23 { + @State selectedIndex: number = 6; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向下抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear24.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear24.ets new file mode 100644 index 0000000000000000000000000000000000000000..99166b7d98abc99f9245cc1960e98a5c583271e1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear24.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear24 { + @State selectedIndex: number = 7; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker拖动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Gray, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上/向下拖动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear25.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear25.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad4d995f15a53b14a75289fc4bbf7611cbfbef4b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear25.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear25 { + @State selectedIndex: number[] = [1, 4]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向上抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Red, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear26.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear26.ets new file mode 100644 index 0000000000000000000000000000000000000000..da13d94d160d9d068ba79a3368804a2eb1ca9ec6 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear26.ets @@ -0,0 +1,79 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear26 { + @State selectedIndex: number[] = [3, 3]; + private multiOptions: string[][] = [ + ['选项1', '选项2', '选项3', '选项4', '选项5'], + ['子选项1', '子选项2', '子选项3', '子选项4', '子选项5'] + ]; + private multipleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(50), + LengthMetrics.percent(50) + ]; + + build() { + Column() { + Text('多列TextPicker向上抛滑测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.multiOptions[0][this.selectedIndex[0]] + ' - ' + this.multiOptions[1][this.selectedIndex[1]]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.multiOptions, + selected: this.selectedIndex, + columnWidths: this.multipleColumnWidths + }) + .id('multi_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 14, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 16, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number[]; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onScrollStop ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onEnterSelectedArea ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)); + }) + .width('90%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上抛滑观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear27.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear27.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5abd7eeb8827f7786e2767cfdacb7daf3867165 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear27.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear27 { + @State selectedIndex: number = 8; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker点击下面备选项测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Green, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 点击下面备选项观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear28.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear28.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddcce5d912d88f6972ed71ec0f4ab3532c6824b3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear28.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear28 { + @State selectedIndex: number = 9; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker焦点显示测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Orange, font: { size: 20, weight: FontWeight.Bold } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 观察选中项的焦点显示效果') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear29.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear29.ets new file mode 100644 index 0000000000000000000000000000000000000000..b37725f77097f3eadc2eb638c461dbd76d304c95 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear29.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear29 { + @State selectedIndex: number = 0; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向上滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Blue, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向上滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear30.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear30.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf5f2319f8d052b39a0c0e954007fdd58447da53 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/textPicker_wear/textPickerWear30.ets @@ -0,0 +1,76 @@ +/** + * 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 { LengthMetrics } from '@kit.ArkUI'; + +@Entry +@Component +struct textPickerWear30 { + @State selectedIndex: number = 1; + private singleOptions: string[] = ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']; + private singleColumnWidths: LengthMetrics[] = [ + LengthMetrics.percent(100) + ]; + + build() { + Column() { + Text('单列TextPicker向下滑动测试') + .fontSize(20) + .fontWeight(FontWeight.Bold) + .margin({ bottom: 20 }) + + Text('当前选中: ' + this.singleOptions[this.selectedIndex]) + .fontSize(16) + .margin({ bottom: 10 }) + + TextPicker({ + range: this.singleOptions, + selected: this.selectedIndex, + value: this.singleOptions[this.selectedIndex], + columnWidths: this.singleColumnWidths + }) + .id('single_text_picker') + .disappearTextStyle({ color: Color.Gray, font: { size: 15, weight: FontWeight.Lighter } }) + .textStyle({ color: Color.Black, font: { size: 18, weight: FontWeight.Normal } }) + .selectedTextStyle({ color: Color.Pink, font: { size: 18, weight: FontWeight.Medium } }) + .defaultPickerItemHeight(50) + .canLoop(false) + .onChange((value: string | string[], index: number | number[]) => { + this.selectedIndex = index as number; + }) + .onScrollStop((value: string | string[], index: number | number[]) => { + console.info('TextPicker scroll stopped, value: ' + value + ', index: ' + index); + }) + .onEnterSelectedArea((value: string | string[], index: number | number[]) => { + console.info('TextPicker item enter selected area, value: ' + value + ', index: ' + index); + }) + .width('80%') + .height(200) + .backgroundColor(Color.White) + .borderRadius(10) + .margin({ bottom: 20 }) + + Text('测试说明: 向下滑动观察选中项变化') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + } + .width('100%') + .height('100%') + .backgroundColor('#F5F5F5') + .padding(20) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file