From 9bae96a6a2ffaed9b3339c7a95258f0db31d351d Mon Sep 17 00:00:00 2001 From: dongwei Date: Tue, 2 Sep 2025 14:53:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?Toast=20=E7=BB=84=E4=BB=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../ToastPromptAction.test.ets | 1236 +++++++++++++++++ 1 file changed, 1236 insertions(+) create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets new file mode 100644 index 00000000..a6927c8c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets @@ -0,0 +1,1236 @@ +/** + * 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 ToastPromptActionTest () { + + describe('ToastPromptActionTest', () => { + 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_POPUPBOX_PROMPT_PROMPTACTION_0040 + * @tc.name : Multiple Toast components with Default/Top_Most/SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction04") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + + // 先查找所有按钮,确保页面完全加载 + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_04'), 1000); + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_04'), 1000); + + // 依次启动多个Toast + await toast1Button.click(); + await driver.waitForIdle(500,2000); + console.log('ToastPromptActionTest Toast1.click success') + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_01') + await Utils.sleep(1000) + + await toast2Button.click(); + console.log('ToastPromptActionTest Toast2.click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_02') + await Utils.sleep(1000) + + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_04'), 1000); + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_04'), 1000); + // 依次关闭Toast + await close1Button.click(); + console.log('ToastPromptActionTest Close1.click success') + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + await close2Button.click(); + console.log('ToastPromptActionTest Close2.click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020 + * @tc.name : Single Toast component with TOP_MOST showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction02") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_02'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_02'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010 + * @tc.name : Multiple Toast components with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction01") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_01'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_01'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090 + * @tc.name : Multiple Toast components with Default/Top_Most/SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction09") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_09'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_09'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070 + * @tc.name : Single Toast component with TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction07") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_07'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080 + * @tc.name : Single Toast component with TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction08") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_08'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060 + * @tc.name : Single Toast component with Default showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction06") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_06'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_06'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction10") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + + // 先查找所有按钮,确保页面完全加载 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_10'), 1000); + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_10'), 1000); + + // 验证按钮是否可见 + await driver.assertComponentExist(ON.id('open_toast_button_10')); + await driver.assertComponentExist(ON.id('close_toast_button_10')); + + // 打开Toast + await openButton.click(); + console.log('ToastPromptActionTest open_toast_button_10.click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100_01') + await Utils.sleep(1000) + + // 重新查找关闭按钮,确保它仍然可用 + closeButton = await driver.waitForComponent(ON.id('close_toast_button_10'), 1000); + + // 关闭Toast + await closeButton.click(); + console.log('close_toast_button_10 close_toast_button_10.click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050 + * @tc.name : Multiple Toast components with Default/Top_Most/SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction05") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_05'), 1000); + await toast1Button.click(); + console.log('toastLog toast1_button_05 click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_05'), 1000); + await toast2Button.click(); + console.log('toastLog toast2_button_05 click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_05'), 1000); + await close1Button.click(); + console.log('toastLog close1_button_05 click success') + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_05'), 1000); + await close2Button.click(); + console.log('toastLog close2_button_05 click success') + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030 + * @tc.name : Single Toast component with DEFAULT showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction03") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_03'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_03'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120 + * @tc.name : Multiple Toast components with Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction12") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_12'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_12'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_12'), 1000); + await close1Button.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_12'), 1000); + await close2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110 + * @tc.name : Multiple Toast components with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction11") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_11'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_11'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_11'), 1000); + await close1Button.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_11'), 1000); + await close2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction16") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_16'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140 + * @tc.name : Single Toast component with Default showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction14") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_14'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_14'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150 + * @tc.name : Multiple Toast components with Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction15") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_15'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_15'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130 + * @tc.name : Single Toast component with TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction13") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_13'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_13'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction17") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_17'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_17'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180 + * @tc.name : Multiple Toast components with SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction18") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_18'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_18'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200 + * @tc.name : Multiple Toast components with SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction20") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_20'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_20'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190 + * @tc.name : Multiple Toast components with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction19") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_19'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_19'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_19'), 1000); + await close1Button.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_19'), 1000); + await close2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210 + * @tc.name : Multiple Toast components with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction21") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_21'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_21'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250 + * @tc.name : Single Toast component with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction25") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_25'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240 + * @tc.name : Multiple Toast components with Default/Top_Most/SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction24") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_24'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_24'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230 + * @tc.name : Single Toast component with DEFAULT showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction23") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_23'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_23'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270 + * @tc.name : Multiple Toast components with Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction27") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_27'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_27'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300 + * @tc.name : Single Toast component with TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction30") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_30'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_30'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310 + * @tc.name : Single Toast component with Default showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction31") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_31'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction22") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast并截图验证 + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_22'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220_01') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction26") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_26'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_26'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290 + * @tc.name : Multiple Toast components with SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction29") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_29'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_29'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_29'), 1000); + await close1Button.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_29'), 1000); + await close2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320 + * @tc.name : Multiple Toast components with Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction32") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_32'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_32'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_02') + await Utils.sleep(1000) + + // 依次关闭Toast + let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_32'), 1000); + await close1Button.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_32'), 1000); + await close2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_03') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280 + * @tc.name : Multiple Toast components with SYSTEM_Top_Most showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction28") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 依次启动多个Toast + let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_28'), 1000); + await toast1Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280_01') + await Utils.sleep(1000) + + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_28'), 1000); + await toast2Button.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330 + * @tc.name : Single Toast component with TOP_MOST showMode, continuous open/close + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction33") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_33'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_33'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330_02') + await Utils.sleep(1000) + + // 连续多次操作 + for (let i = 0; i < 2; i++) { + await openButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + await closeButton.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(500); + } + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330 finish.`); + done() + }) + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340 + * @tc.name : Single Toast component with SYSTEM_TOP_MOST showMode + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340 start.`); + Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction34") + let driver:Driver = Driver.create(); + await driver.waitForIdle(200,500); + await Utils.sleep(1000); + + // 打开Toast + let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_34'), 1000); + await openButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340_01') + await Utils.sleep(1000) + + // 关闭Toast + let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_34'), 1000); + await closeButton.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340_02') + await Utils.sleep(1000) + + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340 finish.`); + done() + }) + + }) +} -- Gitee From 7166e7ad2a37b184840be7c127540cac8c98c29b Mon Sep 17 00:00:00 2001 From: dongwei Date: Tue, 2 Sep 2025 14:54:27 +0800 Subject: [PATCH 2/5] =?UTF-8?q?Toast=20=E7=BB=84=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../toastPromptAction01.ets | 143 ++++++++++++++ .../toastPromptAction02.ets | 143 ++++++++++++++ .../toastPromptAction03.ets | 137 ++++++++++++++ .../toastPromptAction04.ets | 177 ++++++++++++++++++ .../toastPromptAction05.ets | 177 ++++++++++++++++++ .../toastPromptAction06.ets | 143 ++++++++++++++ .../toastPromptAction07.ets | 118 ++++++++++++ .../toastPromptAction08.ets | 118 ++++++++++++ .../toastPromptAction09.ets | 177 ++++++++++++++++++ .../toastPromptAction10.ets | 143 ++++++++++++++ .../toastPromptAction11.ets | 177 ++++++++++++++++++ .../toastPromptAction12.ets | 177 ++++++++++++++++++ .../toastPromptAction13.ets | 137 ++++++++++++++ 13 files changed, 1967 insertions(+) create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction10.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets new file mode 100644 index 00000000..037eb494 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction01 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0010 - 多个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_01') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_01') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Toast1显示第一个Toast,然后点击Toast2显示第二个Toast,观察第一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:第二个Toast显示时,第一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets new file mode 100644 index 00000000..a7f9527c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction02 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0020 - 单个Toast组件TOP_MOST showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_02') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_02') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets new file mode 100644 index 00000000..fb6903db --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets @@ -0,0 +1,137 @@ +/** + * 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 toastPromptAction03 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0030 - 单个Toast组件DEFAULT showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: DEFAULT - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_03') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_03') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets new file mode 100644 index 00000000..21536b8d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction04 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0040 - 多个Toast组件Default/Top_Most/SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default/Top_Most/SYSTEM_Top_Most - 同一类型的Toast只能打开一个') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_04') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_04') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_04') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_04') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:同一类型的Toast只能打开一个') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets new file mode 100644 index 00000000..092eee56 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction05 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0050 - 多个Toast组件Default/Top_Most/SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default/Top_Most/SYSTEM_Top_Most - 同一类型的Toast只能打开一个') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_05') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_05') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_05') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_05') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:同一类型的Toast只能打开一个') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets new file mode 100644 index 00000000..47da5b99 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction06 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0060 - 单个Toast组件Default showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_06') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_06') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets new file mode 100644 index 00000000..76447d2e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction07 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0070 - 单个Toast组件TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_07') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets new file mode 100644 index 00000000..942f4dd3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction08 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0080 - 单个Toast组件TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_08') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets new file mode 100644 index 00000000..e284b182 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction09 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0090 - 多个Toast组件Default/Top_Most/SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default/Top_Most/SYSTEM_Top_Most - 同一类型的Toast只能打开一个') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_09') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_09') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_09') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_09') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:同一类型的Toast只能打开一个') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction10.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction10.ets new file mode 100644 index 00000000..943de2c0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction10.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction10 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0100 - 单个Toast组件TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_10') + .type(ButtonType.Capsule) + .height(100) + .width(120) + .backgroundColor(Color.Green) + .fontColor(Color.White) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 100, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_10') + .type(ButtonType.Capsule) + .height(100) + .width(120) + .backgroundColor(Color.Blue) + .fontColor(Color.White) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets new file mode 100644 index 00000000..e9f46d19 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction11 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0110 - 多个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_11') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_11') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_11') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_11') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets new file mode 100644 index 00000000..2778d936 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction12 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0120 - 多个Toast组件Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_12') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_12') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_12') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_12') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets new file mode 100644 index 00000000..99eb4d0d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets @@ -0,0 +1,137 @@ +/** + * 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 toastPromptAction13 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0130 - 单个Toast组件TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_13') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_13') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} -- Gitee From c9809b0d8ad0d91810a9ec9adf5cc2e1af702dce Mon Sep 17 00:00:00 2001 From: dongwei Date: Tue, 2 Sep 2025 14:54:59 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Toast=20=E7=BB=84=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../toastPromptAction14.ets | 143 ++++++++++++++ .../toastPromptAction15.ets | 144 ++++++++++++++ .../toastPromptAction16.ets | 118 ++++++++++++ .../toastPromptAction17.ets | 143 ++++++++++++++ .../toastPromptAction18.ets | 144 ++++++++++++++ .../toastPromptAction19.ets | 177 ++++++++++++++++++ .../toastPromptAction20.ets | 144 ++++++++++++++ .../toastPromptAction21.ets | 144 ++++++++++++++ .../toastPromptAction22.ets | 118 ++++++++++++ .../toastPromptAction23.ets | 137 ++++++++++++++ .../toastPromptAction24.ets | 144 ++++++++++++++ .../toastPromptAction25.ets | 118 ++++++++++++ .../toastPromptAction26.ets | 143 ++++++++++++++ .../toastPromptAction27.ets | 144 ++++++++++++++ 14 files changed, 1961 insertions(+) create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets new file mode 100644 index 00000000..feb69ee8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction14 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0140 - 单个Toast组件Default showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_14') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_14') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets new file mode 100644 index 00000000..8e1b86f1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction15 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0150 - 多个Toast组件Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_15') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_15') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets new file mode 100644 index 00000000..1b83ac68 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction16 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0160 - 单个Toast组件SYSTEM_TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_TOP_MOST - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_16') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets new file mode 100644 index 00000000..8eaa0d95 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction17 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0170 - 单个Toast组件SYSTEM_TOP_MOST showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_TOP_MOST - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_17') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_17') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets new file mode 100644 index 00000000..23d64169 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction18 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0180 - 多个Toast组件SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_18') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_18') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets new file mode 100644 index 00000000..a40f9503 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction19 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0190 - 多个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_19') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_19') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_19') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_19') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets new file mode 100644 index 00000000..7c733c97 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction20 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0200 - 多个Toast组件SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_20') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_20') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets new file mode 100644 index 00000000..d13db235 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction21 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0210 - 多个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_21') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_21') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets new file mode 100644 index 00000000..3d71f482 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction22 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0220 - 单个Toast组件SYSTEM_TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_TOP_MOST - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_22') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets new file mode 100644 index 00000000..e17696c8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets @@ -0,0 +1,137 @@ +/** + * 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 toastPromptAction23 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0230 - 单个Toast组件DEFAULT showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: DEFAULT - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_23') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_23') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets new file mode 100644 index 00000000..5e28b495 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction24 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0240 - 多个Toast组件Default/Top_Most/SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default/Top_Most/SYSTEM_Top_Most - 同一类型的Toast只能打开一个') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_24') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_24') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察同一类型的Toast只能打开一个') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:同一类型的Toast只能打开一个') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets new file mode 100644 index 00000000..ed1f9f71 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction25 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0250 - 单个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_25') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets new file mode 100644 index 00000000..3a134329 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction26 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0260 - 单个Toast组件SYSTEM_TOP_MOST showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_TOP_MOST - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_26') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_26') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets new file mode 100644 index 00000000..956d5696 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction27 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0270 - 多个Toast组件Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_27') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_27') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} -- Gitee From aab1f35c393df1f1b9db8e28a504c4b8f8ce6ff3 Mon Sep 17 00:00:00 2001 From: dongwei Date: Tue, 2 Sep 2025 14:55:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?Toast=20=E7=BB=84=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../toastPromptAction28.ets | 144 ++++++++++++++ .../toastPromptAction29.ets | 177 ++++++++++++++++++ .../toastPromptAction30.ets | 137 ++++++++++++++ .../toastPromptAction31.ets | 118 ++++++++++++ .../toastPromptAction32.ets | 177 ++++++++++++++++++ .../toastPromptAction33.ets | 143 ++++++++++++++ .../toastPromptAction34.ets | 137 ++++++++++++++ 7 files changed, 1033 insertions(+) create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets create mode 100644 sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets new file mode 100644 index 00000000..91e4cfd6 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets @@ -0,0 +1,144 @@ +/** + * 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 toastPromptAction28 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0280 - 多个Toast组件SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_28') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_28') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,观察后面一个Toast打开后,前一个Toast是否自动关闭') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1按钮显示第一个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Toast2按钮显示第二个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets new file mode 100644 index 00000000..cea99ce5 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction29 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0290 - 多个Toast组件SYSTEM_Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_29') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_29') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_29') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_29') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets new file mode 100644 index 00000000..652a2770 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets @@ -0,0 +1,137 @@ +/** + * 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 toastPromptAction30 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0300 - 单个Toast组件TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_30') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_30') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets new file mode 100644 index 00000000..c5ac5756 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets @@ -0,0 +1,118 @@ +/** + * 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 toastPromptAction31 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0310 - 单个Toast组件Default showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Default - 测试Toast正常显示') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_31') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是DEFAULT模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.DEFAULT + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,观察Toast正常显示') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 预期效果:Toast正常显示') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets new file mode 100644 index 00000000..665869a4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets @@ -0,0 +1,177 @@ +/** + * 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 toastPromptAction32 { + @State toastId1: number = 0; + @State toastId2: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0320 - 多个Toast组件Top_Most showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: Top_Most - 后面一个Toast打开后,前一个Toast自动关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Toast1') + .id('toast1_button_32') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第一个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId1 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Toast2') + .id('toast2_button_32') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是第二个Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId2 = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 关闭按钮 + Row({ space: 10 }) { + Button('Close1') + .id('close1_button_32') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId1); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + Button('Close2') + .id('close2_button_32') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId2); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('依次启动多个Toast,然后依次关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Toast1和Toast2依次启动多个Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close1和Close2依次关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:后面一个Toast打开后,前一个Toast自动关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets new file mode 100644 index 00000000..6b51bb79 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets @@ -0,0 +1,143 @@ +/** + * 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 toastPromptAction33 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0330 - 单个Toast组件TOP_MOST showMode连续操作') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: TOP_MOST - 测试连续打开/关闭Toast') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_33') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_33') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast,测试连续操作') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 连续多次执行打开/关闭操作') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('4. 预期效果:Toast连续打开/关闭正常') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets new file mode 100644 index 00000000..cf04a3e2 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets @@ -0,0 +1,137 @@ +/** + * 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 toastPromptAction34 { + @State toastId: number = 0; + private uiContext: UIContext = this.getUIContext(); + private promptAction: PromptAction = this.uiContext.getPromptAction(); + + build() { + Column() { + // 页面标题 + Text('测试用例0340 - 单个Toast组件SYSTEM_TOP_MOST showMode') + .height(50) + .fontSize(16) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(20) + .fontWeight(FontWeight.Bold) + .margin({ top: 8, bottom: 8 }); + + // 状态说明 + Text('showMode: SYSTEM_TOP_MOST - 测试Toast正常显示和关闭') + .height(35) + .fontSize(12) + .textAlign(TextAlign.Center) + .fontColor(Color.Black) + .width('100%') + .border({ width: 1 }) + .lineHeight(16) + .fontWeight(300) + .margin({ bottom: 8 }); + + // 操作按钮 + Row({ space: 10 }) { + Button('Open Toast') + .id('open_toast_button_34') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.openToast({ + message: '这是SYSTEM_TOP_MOST模式的Toast消息', + duration: 3000, + showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST + }).then((toastId: number) => { + this.toastId = toastId; + }); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`OpenToast error code is ${code}, message is ${message}`); + } + }) + Button('Close Toast') + .id('close_toast_button_34') + .type(ButtonType.Capsule) + .height(100) + .onClick(() => { + try { + this.promptAction.closeToast(this.toastId); + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + console.error(`CloseToast error code is ${code}, message is ${message}`); + } + }) + } + .width('100%') + .justifyContent(FlexAlign.Center) + .margin({ bottom: 10 }); + + // 说明文字 + Text('点击Open Toast显示Toast,点击Close Toast关闭Toast') + .fontSize(14) + .fontColor(Color.Gray) + .textAlign(TextAlign.Center) + .width('90%') + .margin({ top: 20 }); + + // 测试区域 + Column({ space: 20 }) { + Text('测试说明:') + .fontSize(16) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Blue) + .width('100%') + .textAlign(TextAlign.Center); + + Text('1. 点击Open Toast按钮显示Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('2. 点击Close Toast按钮关闭Toast') + .fontSize(14) + .fontColor(Color.Black) + .width('100%') + .textAlign(TextAlign.Start); + + Text('3. 预期效果:Toast正常显示和关闭') + .fontSize(14) + .fontColor(Color.Green) + .width('100%') + .textAlign(TextAlign.Start); + } + .width('90%') + .padding(15) + .backgroundColor(0xF5F5F5) + .borderRadius(10) + .margin({ top: 20 }); + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5, left: 10, right: 10 }) + } +} -- Gitee From b0c6bc67887342a3f01d821f0440e1b2d79cdf73 Mon Sep 17 00:00:00 2001 From: dongwei Date: Tue, 2 Sep 2025 20:44:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?Toast=20=E9=83=A8=E5=88=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E6=B5=8B=E8=AF=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../ToastPromptAction.test.ets | 499 ++++++++++-------- .../toastPromptAction01.ets | 4 +- .../toastPromptAction02.ets | 2 +- .../toastPromptAction03.ets | 2 +- .../toastPromptAction04.ets | 6 +- .../toastPromptAction05.ets | 4 +- .../toastPromptAction06.ets | 2 +- .../toastPromptAction07.ets | 2 +- .../toastPromptAction08.ets | 2 +- .../toastPromptAction09.ets | 4 +- .../toastPromptAction11.ets | 4 +- .../toastPromptAction12.ets | 4 +- .../toastPromptAction13.ets | 2 +- .../toastPromptAction14.ets | 2 +- .../toastPromptAction15.ets | 4 +- .../toastPromptAction16.ets | 2 +- .../toastPromptAction17.ets | 2 +- .../toastPromptAction18.ets | 4 +- .../toastPromptAction19.ets | 4 +- .../toastPromptAction20.ets | 4 +- .../toastPromptAction21.ets | 4 +- .../toastPromptAction22.ets | 2 +- .../toastPromptAction23.ets | 2 +- .../toastPromptAction24.ets | 4 +- .../toastPromptAction25.ets | 2 +- .../toastPromptAction26.ets | 2 +- .../toastPromptAction27.ets | 4 +- .../toastPromptAction28.ets | 4 +- .../toastPromptAction29.ets | 4 +- .../toastPromptAction30.ets | 2 +- .../toastPromptAction31.ets | 2 +- .../toastPromptAction32.ets | 4 +- .../toastPromptAction33.ets | 2 +- .../toastPromptAction34.ets | 2 +- 34 files changed, 340 insertions(+), 259 deletions(-) diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets index a6927c8c..57fce87b 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/toast_promptAction/ToastPromptAction.test.ets @@ -56,34 +56,37 @@ export default function ToastPromptActionTest () { // 先查找所有按钮,确保页面完全加载 let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_04'), 1000); let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_04'), 1000); - + // 依次启动多个Toast await toast1Button.click(); await driver.waitForIdle(500,2000); console.log('ToastPromptActionTest Toast1.click success') windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_01') await Utils.sleep(1000) - + await toast2Button.click(); - console.log('ToastPromptActionTest Toast2.click success') + console.log('ToastPromptActionTest Toast2.click success1') await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_02') - await Utils.sleep(1000) + await Utils.sleep(2500) + await driver.waitForIdle(500,2000); let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_04'), 1000); let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_04'), 1000); + // 依次关闭Toast + await close2Button.click(); + console.log('ToastPromptActionTest Close2.click success') + await driver.waitForIdle(500,2000); + await close1Button.click(); console.log('ToastPromptActionTest Close1.click success') await driver.waitForIdle(500,2000); await Utils.sleep(1000); - - await close2Button.click(); - console.log('ToastPromptActionTest Close2.click success') - await driver.waitForIdle(500,2000); + windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0040 finish.`); done() }) @@ -100,31 +103,47 @@ export default function ToastPromptActionTest () { Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction02") let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); - + // 打开Toast - let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_02'), 1000); - await openButton.click(); + let openButton1: Component = await driver.waitForComponent(ON.id('open_toast_button_02'), 1000); + await openButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + + await driver.waitForIdle(1500,2500); // 关闭Toast - let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_02'), 1000); - await closeButton.click(); + let closeButton1: Component = await driver.waitForComponent(ON.id('close_toast_button_02'), 1000); + await closeButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020_02') await Utils.sleep(1000) - - // 连续多次操作 - for (let i = 0; i < 2; i++) { - await openButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - await closeButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - } - + + // 多次打开关闭 + // 打开Toast + let openButton2: Component = await driver.waitForComponent(ON.id('open_toast_button_02'), 1000); + await openButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500); + + // 关闭Toast + let closeButton2: Component = await driver.waitForComponent(ON.id('close_toast_button_02'), 1000); + await closeButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + // 打开Toast + let openButton3: Component = await driver.waitForComponent(ON.id('open_toast_button_02'), 1000); + await openButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500); + + // 关闭Toast + let closeButton3: Component = await driver.waitForComponent(ON.id('close_toast_button_02'), 1000); + await closeButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0020 finish.`); done() }) @@ -142,20 +161,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_01'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_01'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0010 finish.`); done() }) @@ -173,20 +192,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_09'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_09'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0090 finish.`); done() }) @@ -204,14 +223,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_07'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0070 finish.`); done() }) @@ -229,14 +248,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_08'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0080 finish.`); done() }) @@ -254,21 +273,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_06'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060_01') await Utils.sleep(1000) - + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_06'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060_02') await Utils.sleep(1000) - + // 连续多次操作 for (let i = 0; i < 2; i++) { await openButton.click(); @@ -278,7 +297,7 @@ export default function ToastPromptActionTest () { await driver.waitForIdle(500,2000); await Utils.sleep(500); } - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0060 finish.`); done() }) @@ -295,32 +314,32 @@ export default function ToastPromptActionTest () { Settings.createWindow("testability/pages/toast_promptAction/toastPromptAction10") let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); - + // 先查找所有按钮,确保页面完全加载 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_10'), 1000); let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_10'), 1000); - + // 验证按钮是否可见 await driver.assertComponentExist(ON.id('open_toast_button_10')); await driver.assertComponentExist(ON.id('close_toast_button_10')); - + // 打开Toast await openButton.click(); console.log('ToastPromptActionTest open_toast_button_10.click success') await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 重新查找关闭按钮,确保它仍然可用 closeButton = await driver.waitForComponent(ON.id('close_toast_button_10'), 1000); - + // 关闭Toast await closeButton.click(); console.log('close_toast_button_10 close_toast_button_10.click success') await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0100 finish.`); done() }) @@ -338,7 +357,7 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_05'), 1000); await toast1Button.click(); @@ -346,28 +365,28 @@ export default function ToastPromptActionTest () { await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_05'), 1000); await toast2Button.click(); console.log('toastLog toast2_button_05 click success') await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_05'), 1000); await close1Button.click(); console.log('toastLog close1_button_05 click success') await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_05'), 1000); await close2Button.click(); console.log('toastLog close2_button_05 click success') await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0050 finish.`); done() }) @@ -385,21 +404,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_03'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030_01') await Utils.sleep(1000) - + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_03'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0030 finish.`); done() }) @@ -417,32 +436,32 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_12'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_12'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_12'), 1000); await close1Button.click(); await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_12'), 1000); await close2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0120 finish.`); done() }) @@ -460,32 +479,32 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_11'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_11'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_02') await Utils.sleep(1000) - + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_11'), 1000); await close1Button.click(); await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_11'), 1000); await close2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0110 finish.`); done() }) @@ -503,14 +522,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_16'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0160 finish.`); done() }) @@ -528,31 +547,46 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast - let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_14'), 1000); - await openButton.click(); + let openButton1: Component = await driver.waitForComponent(ON.id('open_toast_button_14'), 1000); + await openButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140_01') await Utils.sleep(1000) - + // 关闭Toast - let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_14'), 1000); - await closeButton.click(); + let closeButton1: Component = await driver.waitForComponent(ON.id('close_toast_button_14'), 1000); + await closeButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140_02') await Utils.sleep(1000) - - // 连续多次操作 - for (let i = 0; i < 2; i++) { - await openButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - await closeButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - } - + + // 多次打开关闭 + // 打开Toast + let openButton2: Component = await driver.waitForComponent(ON.id('open_toast_button_14'), 1000); + await openButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + // 关闭Toast + let closeButton2: Component = await driver.waitForComponent(ON.id('close_toast_button_14'), 1000); + await closeButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + // 打开Toast + let openButton3: Component = await driver.waitForComponent(ON.id('open_toast_button_14'), 1000); + await openButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + // 关闭Toast + let closeButton3: Component = await driver.waitForComponent(ON.id('close_toast_button_14'), 1000); + await closeButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0140 finish.`); done() }) @@ -570,20 +604,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_15'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_15'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0150 finish.`); done() }) @@ -601,21 +635,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_13'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_13'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0130 finish.`); done() }) @@ -633,31 +667,46 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast - let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_17'), 1000); - await openButton.click(); + let openButton1: Component = await driver.waitForComponent(ON.id('open_toast_button_17'), 1000); + await openButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast - let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_17'), 1000); - await closeButton.click(); + let closeButton1: Component = await driver.waitForComponent(ON.id('close_toast_button_17'), 1000); + await closeButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170_02') await Utils.sleep(1000) - - // 连续多次操作 - for (let i = 0; i < 2; i++) { - await openButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - await closeButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - } - + + // 多次打开关闭 + // 打开Toast + let openButton2: Component = await driver.waitForComponent(ON.id('open_toast_button_17'), 1000); + await openButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500) + + // 关闭Toast + let closeButton2: Component = await driver.waitForComponent(ON.id('close_toast_button_17'), 1000); + await closeButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000) + + // 打开Toast + let openButton3: Component = await driver.waitForComponent(ON.id('open_toast_button_17'), 1000); + await openButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500) + + // 关闭Toast + let closeButton3: Component = await driver.waitForComponent(ON.id('close_toast_button_17'), 1000); + await closeButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0170 finish.`); done() }) @@ -675,20 +724,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_18'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_18'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0180 finish.`); done() }) @@ -706,20 +755,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_20'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_20'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0200 finish.`); done() }) @@ -737,32 +786,32 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_19'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_19'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_19'), 1000); await close1Button.click(); await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_19'), 1000); await close2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0190 finish.`); done() }) @@ -780,20 +829,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_21'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_21'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0210 finish.`); done() }) @@ -811,14 +860,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_25'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0250 finish.`); done() }) @@ -836,20 +885,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_24'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240_01') await Utils.sleep(1000) - + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_24'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0240 finish.`); done() }) @@ -867,21 +916,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_23'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230_01') await Utils.sleep(1000) - + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_23'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0230 finish.`); done() }) @@ -899,20 +948,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_27'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_27'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0270 finish.`); done() }) @@ -930,21 +979,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_30'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_30'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0300 finish.`); done() }) @@ -962,14 +1011,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_31'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0310 finish.`); done() }) @@ -987,14 +1036,14 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast并截图验证 let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_22'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220_01') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0220 finish.`); done() }) @@ -1012,31 +1061,46 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast - let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_26'), 1000); - await openButton.click(); + let openButton1: Component = await driver.waitForComponent(ON.id('open_toast_button_26'), 1000); + await openButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast - let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_26'), 1000); - await closeButton.click(); + let closeButton1: Component = await driver.waitForComponent(ON.id('close_toast_button_26'), 1000); + await closeButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260_02') await Utils.sleep(1000) - - // 连续多次操作 - for (let i = 0; i < 2; i++) { - await openButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - await closeButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - } - + + // 多次打开关闭 + // 打开Toast + let openButton2: Component = await driver.waitForComponent(ON.id('open_toast_button_26'), 1000); + await openButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500) + + // 关闭Toast + let closeButton2: Component = await driver.waitForComponent(ON.id('close_toast_button_26'), 1000); + await closeButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000) + + // 打开Toast + let openButton3: Component = await driver.waitForComponent(ON.id('open_toast_button_26'), 1000); + await openButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500) + + // 关闭Toast + let closeButton3: Component = await driver.waitForComponent(ON.id('close_toast_button_26'), 1000); + await closeButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0260 finish.`); done() }) @@ -1054,32 +1118,32 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_29'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_29'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_29'), 1000); await close1Button.click(); await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_29'), 1000); await close2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0290 finish.`); done() }) @@ -1097,32 +1161,32 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_32'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_32'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_02') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 依次关闭Toast let close1Button: Component = await driver.waitForComponent(ON.id('close1_button_32'), 1000); await close1Button.click(); await driver.waitForIdle(500,2000); await Utils.sleep(500); - + let close2Button: Component = await driver.waitForComponent(ON.id('close2_button_32'), 1000); await close2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320_03') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0320 finish.`); done() }) @@ -1140,20 +1204,20 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 依次启动多个Toast let toast1Button: Component = await driver.waitForComponent(ON.id('toast1_button_28'), 1000); await toast1Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + let toast2Button: Component = await driver.waitForComponent(ON.id('toast2_button_28'), 1000); await toast2Button.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0280 finish.`); done() }) @@ -1171,31 +1235,46 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast - let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_33'), 1000); - await openButton.click(); + let openButton1: Component = await driver.waitForComponent(ON.id('open_toast_button_33'), 1000); + await openButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast - let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_33'), 1000); - await closeButton.click(); + let closeButton1: Component = await driver.waitForComponent(ON.id('close_toast_button_33'), 1000); + await closeButton1.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330_02') await Utils.sleep(1000) - - // 连续多次操作 - for (let i = 0; i < 2; i++) { - await openButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - await closeButton.click(); - await driver.waitForIdle(500,2000); - await Utils.sleep(500); - } - + + // 多次打开关闭 + // 打开Toast + let openButton2: Component = await driver.waitForComponent(ON.id('open_toast_button_33'), 1000); + await openButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500); + + // 关闭Toast + let closeButton2: Component = await driver.waitForComponent(ON.id('close_toast_button_33'), 1000); + await closeButton2.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + + // 打开Toast + let openButton3: Component = await driver.waitForComponent(ON.id('open_toast_button_33'), 1000); + await openButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(2500); + + // 关闭Toast + let closeButton3: Component = await driver.waitForComponent(ON.id('close_toast_button_33'), 1000); + await closeButton3.click(); + await driver.waitForIdle(500,2000); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0330 finish.`); done() }) @@ -1213,21 +1292,21 @@ export default function ToastPromptActionTest () { let driver:Driver = Driver.create(); await driver.waitForIdle(200,500); await Utils.sleep(1000); - + // 打开Toast let openButton: Component = await driver.waitForComponent(ON.id('open_toast_button_34'), 1000); await openButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340_01') - await Utils.sleep(1000) - + await Utils.sleep(2500) + // 关闭Toast let closeButton: Component = await driver.waitForComponent(ON.id('close_toast_button_34'), 1000); await closeButton.click(); await driver.waitForIdle(500,2000); windowSnap.snapShot('SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340_02') await Utils.sleep(1000) - + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_POPUPBOX_PROMPT_PROMPTACTION_0340 finish.`); done() }) diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets index 037eb494..17fe2c8d 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction01.ets @@ -59,7 +59,7 @@ struct toastPromptAction01 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; @@ -78,7 +78,7 @@ struct toastPromptAction01 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets index a7f9527c..eb782554 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction02.ets @@ -59,7 +59,7 @@ struct toastPromptAction02 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets index fb6903db..6358c1e0 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction03.ets @@ -59,7 +59,7 @@ struct toastPromptAction03 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets index 21536b8d..657ee852 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction04.ets @@ -60,7 +60,7 @@ struct toastPromptAction04 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction04 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; @@ -99,6 +99,7 @@ struct toastPromptAction04 { Row({ space: 10 }) { Button('Close1') .id('close1_button_04') + .zIndex(9999999) .type(ButtonType.Capsule) .height(100) .onClick(() => { @@ -112,6 +113,7 @@ struct toastPromptAction04 { }) Button('Close2') .id('close2_button_04') + .zIndex(9999999) .type(ButtonType.Capsule) .height(100) .onClick(() => { diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets index 092eee56..4a89225a 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction05.ets @@ -60,7 +60,7 @@ struct toastPromptAction05 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction05 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets index 47da5b99..e76ac3fa 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction06.ets @@ -59,7 +59,7 @@ struct toastPromptAction06 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets index 76447d2e..3523b800 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction07.ets @@ -59,7 +59,7 @@ struct toastPromptAction07 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets index 942f4dd3..2b28dc66 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction08.ets @@ -59,7 +59,7 @@ struct toastPromptAction08 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets index e284b182..15eb91d9 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction09.ets @@ -60,7 +60,7 @@ struct toastPromptAction09 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction09 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets index e9f46d19..ff98c453 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction11.ets @@ -60,7 +60,7 @@ struct toastPromptAction11 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction11 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets index 2778d936..f5369064 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction12.ets @@ -60,7 +60,7 @@ struct toastPromptAction12 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction12 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets index 99eb4d0d..e4c0d973 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction13.ets @@ -59,7 +59,7 @@ struct toastPromptAction13 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets index feb69ee8..ae436887 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction14.ets @@ -59,7 +59,7 @@ struct toastPromptAction14 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets index 8e1b86f1..e8ce7aa2 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction15.ets @@ -60,7 +60,7 @@ struct toastPromptAction15 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction15 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets index 1b83ac68..3bb8b073 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction16.ets @@ -59,7 +59,7 @@ struct toastPromptAction16 { try { this.promptAction.openToast({ message: '这是SYSTEM_TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets index 8eaa0d95..6b2694dd 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction17.ets @@ -59,7 +59,7 @@ struct toastPromptAction17 { try { this.promptAction.openToast({ message: '这是SYSTEM_TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets index 23d64169..870a2e62 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction18.ets @@ -60,7 +60,7 @@ struct toastPromptAction18 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction18 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets index a40f9503..200993bb 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction19.ets @@ -60,7 +60,7 @@ struct toastPromptAction19 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction19 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets index 7c733c97..8743742a 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction20.ets @@ -60,7 +60,7 @@ struct toastPromptAction20 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction20 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets index d13db235..1642577c 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction21.ets @@ -60,7 +60,7 @@ struct toastPromptAction21 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction21 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets index 3d71f482..ad698716 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction22.ets @@ -59,7 +59,7 @@ struct toastPromptAction22 { try { this.promptAction.openToast({ message: '这是SYSTEM_TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets index e17696c8..b1028710 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction23.ets @@ -59,7 +59,7 @@ struct toastPromptAction23 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets index 5e28b495..f1c4f604 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction24.ets @@ -60,7 +60,7 @@ struct toastPromptAction24 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction24 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets index ed1f9f71..1ad92f2e 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction25.ets @@ -59,7 +59,7 @@ struct toastPromptAction25 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets index 3a134329..e53a34ff 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction26.ets @@ -59,7 +59,7 @@ struct toastPromptAction26 { try { this.promptAction.openToast({ message: '这是SYSTEM_TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets index 956d5696..852a9f69 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction27.ets @@ -60,7 +60,7 @@ struct toastPromptAction27 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction27 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets index 91e4cfd6..ada54d11 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction28.ets @@ -60,7 +60,7 @@ struct toastPromptAction28 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction28 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets index cea99ce5..84173411 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction29.ets @@ -60,7 +60,7 @@ struct toastPromptAction29 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction29 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets index 652a2770..aa7aa08f 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction30.ets @@ -59,7 +59,7 @@ struct toastPromptAction30 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets index c5ac5756..55090629 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction31.ets @@ -59,7 +59,7 @@ struct toastPromptAction31 { try { this.promptAction.openToast({ message: '这是DEFAULT模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.DEFAULT }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets index 665869a4..863ec9ad 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction32.ets @@ -60,7 +60,7 @@ struct toastPromptAction32 { try { this.promptAction.openToast({ message: '这是第一个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId1 = toastId; @@ -79,7 +79,7 @@ struct toastPromptAction32 { try { this.promptAction.openToast({ message: '这是第二个Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId2 = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets index 6b51bb79..7bd0f365 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction33.ets @@ -59,7 +59,7 @@ struct toastPromptAction33 { try { this.promptAction.openToast({ message: '这是TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.TOP_MOST }).then((toastId: number) => { this.toastId = toastId; diff --git a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets index cf04a3e2..59f8da53 100644 --- a/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets +++ b/sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/toast_promptAction/toastPromptAction34.ets @@ -59,7 +59,7 @@ struct toastPromptAction34 { try { this.promptAction.openToast({ message: '这是SYSTEM_TOP_MOST模式的Toast消息', - duration: 3000, + duration: 1500, showMode: promptAction.ToastShowMode.SYSTEM_TOP_MOST }).then((toastId: number) => { this.toastId = toastId; -- Gitee