diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/ComponentTextTvTest/ComponentTextTv.test.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/ComponentTextTvTest/ComponentTextTv.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf55ee215c4f0207bae2a76d17f40319de7e4084 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/ComponentTextTvTest/ComponentTextTv.test.ets @@ -0,0 +1,367 @@ +/** + * 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'; + +export default function ComponentTextTv() { + + describe('ComponentTextTv', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0070 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0070 + * @tc.type : Set the delay of 008.marqueeOptions to a negative number + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0070', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0070 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0070") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0070 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0040 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0040 + * @tc.type : Set the delay of 004.marqueeOptions to 0. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0040', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0040 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0040") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0040 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0130 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0130 + * @tc.type : Set the fromStart of 014.marqueeOptions to true. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0130', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0130 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0130") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0130 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0150 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0150 + * @tc.type : Set the loop of 016.marqueeOptions to -1. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0150', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0150 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0150") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0150 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0220 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0220 + * @tc.type : Do not set the step of 025.marqueeOptions. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0220', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0220 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0220") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0220 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0280 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0280 + * @tc.type : When a single marquee ends, the onMarqueeStateChange callback is triggered. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0280', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0280 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0280") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0280 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0270 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0270 + * @tc.type : Set the step of 031.marqueeOptions to a very large positive number. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0270', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0270 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0270") + let driver: Driver = Driver.create(); + await driver.waitForIdle(4000,5000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0270 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0290 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0290 + * @tc.type : When all marquees end, the onMarqueeStateChange callback is triggered. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0290', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0290 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0290") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0290 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0360 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0360 + * @tc.type : Set the marqueePolicy of 040.marqueeOptions to 0. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0360', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0360 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0360") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0360 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0370 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0370 + * @tc.type : Set the marqueePolicy of 041.marqueeOptions to 1. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0370', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0370 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0370") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0370 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0590 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0590 + * @tc.type : The setting of containerSpan in the 021.text component, which includes span and imagespan, has an impact on the fade effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0590', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0590 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0590") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0590 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0600 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0600 + * @tc.type : Setting the imagespan subcomponent in the 022.text component affects the fade effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0600', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0600 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0600") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0600 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0580 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0580 + * @tc.type : Change the width of the 020.text component and observe the fade effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0580', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0580 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0580") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0580 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0640 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0640 + * @tc.type : Add decoration lines to the text and observe the fade effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0640', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0640 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0640") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0640 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0610 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0610 + * @tc.type : Set span, imagespan, and symbolspan in the 023.text component and observe the fade effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0610', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0610 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0610") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0610 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0670 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0670 + * @tc.type : The effect of the fade effect previewer. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0670', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0670 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0670") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0670 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_TEXT_TV_0460 + * @tc.name : SUB_ACE_UI_COMPONENT_TEXT_TV_0460 + * @tc.type : The fadeout setting is not effective when 008.textoverflow is not set to Marquee. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_TEXT_TV_0460', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0460 start.`); + Settings.createWindow("testability/pages/ComponentTextTv/ComponentTextTv0460") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_TEXT_TV_0460 finish.`); + done() + }) + + + }) +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/TextFadingEdgeTVTest/TextFadingEdgeTV.test.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/TextFadingEdgeTVTest/TextFadingEdgeTV.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a46d250f66f29178f65ccc36fb485c35b5d174d5 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/test/TextFadingEdgeTVTest/TextFadingEdgeTV.test.ets @@ -0,0 +1,679 @@ +/** + * 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'; + +export default function TextFadingEdgeTV() { + + describe('TextFadingEdgeTV', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0030 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0030 + * @tc.type : The text of the search is too long, textAlign enumeration + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0030', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0030 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0030") + let driver: Driver = Driver.create(); + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_002'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + let Button3: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_003'),1000); + await Button3.click(); + await driver.waitForIdle(500,2000) + let Button4: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_004'),1000); + await Button4.click(); + await driver.waitForIdle(500,2000) + let Button5: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_005'),1000); + await Button5.click(); + await driver.waitForIdle(500,2000) + let Button6: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0030_006'),1000); + await Button6.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0030 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0060 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0060 + * @tc.type : The text of Search is too long, clear and re-enter the long text. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0060', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0060 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0060") + let driver: Driver = Driver.create(); + // cancelButton 是一个 Image 类型的组件 + let cancelButton: Component = await driver.waitForComponent(ON.type('Image'),1000); + // 点击 cancelButton 图标 + await cancelButton.click(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0060_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0060 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0070 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0070 + * @tc.type : The text of Search is too long, edit the text content. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0070', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0070 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0070") + let driver: Driver = Driver.create(); + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0070_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let copybutton: Component = await driver.waitForComponent(ON.text('复制'),1000); + await copybutton.click(); + await driver.waitForIdle(500,2000) + await Button1.click(); + await driver.waitForIdle(500,2000) + let cutbutton: Component = await driver.waitForComponent(ON.text('剪切'),1000); + await cutbutton.click(); + await driver.waitForIdle(500,2000) + await Button1.click(); + await driver.waitForIdle(500,2000) + let pastebutton: Component = await driver.waitForComponent(ON.text('粘贴'),1000); + await pastebutton.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0070 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0050 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0050 + * @tc.type : The search text is too long, and there is a search button. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0050', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0050 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0050") + let driver: Driver = Driver.create(); + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0050_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0050 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0020 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0020 + * @tc.type : The disabled state is too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0020', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0020 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0020") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0020 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0040 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0040 + * @tc.type : The search text is too long, modify the font properties. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0040', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0040 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0040") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0040_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0040_002'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0040 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0210 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0210 + * @tc.type : No input, the search text is not too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0210', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0210 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0210") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0210 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0260 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0260 + * @tc.type : After clearing the oversized text, the placeholder text for no input is displayed correctly. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0260', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0260 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0260") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0260_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + // cancelButton 是一个 Image 类型的组件 + let cancelButton: Component = await driver.waitForComponent(ON.type('Image'),1000); + // 点击 cancelButton 图标 + await cancelButton.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0260 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0390 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0390 + * @tc.type : The input status is that the Search text is not oversized. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0390', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0390 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0390") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0390 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0420 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0420 + * @tc.type : The input text is too long, and it remains too long after deletion. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0420', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0420 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0420") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0420 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0430 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0430 + * @tc.type : The input text is too long, and it remains too long after deletion. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0430', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0430 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0430") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0430 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0440 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0440 + * @tc.type : Limit the maximum length; the text is too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0440', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0440 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0440") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0440_006'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0440 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0480 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0480 + * @tc.type : Search text is too long, set the position of the input cursor. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0480', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0480 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0480") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0480_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0480_006'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0480 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0570 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0570 + * @tc.type : TextInput text is too long, textAlign enum. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0570', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0570 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0570") + let driver: Driver = Driver.create(); + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_002'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + let Button3: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_003'),1000); + await Button3.click(); + await driver.waitForIdle(500,2000) + let Button4: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_004'),1000); + await Button4.click(); + await driver.waitForIdle(500,2000) + let Button5: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_005'),1000); + await Button5.click(); + await driver.waitForIdle(500,2000) + let Button6: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0570_006'),1000); + await Button6.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0570 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0530 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0530 + * @tc.type : showError is too long, no fade-out, no marquee + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0530', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0530 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0530") + let driver: Driver = Driver.create(); + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0530_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0530_002'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + let Button3: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0530_003'),1000); + await Button3.click(); + await driver.waitForIdle(500,2000) + let Button4: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0530_004'),1000); + await Button4.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0530 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0520 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0520 + * @tc.type : The disabled state is too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0520', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0520 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0520") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0520 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0620 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0620 + * @tc.type : Limit the maximum length; the text is too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0620', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0620 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0620") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0620_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0620 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0560 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0560 + * @tc.type : TextInput text is too long, InputType enum. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0560', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0560 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0560") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0560_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0560_006'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0560 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0610 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0610 + * @tc.type : Adjust the padding of the TextInput component to observe the fade-out effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0610', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0610 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0610") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0610_001'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + let Button2: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0610_002'),1000); + await Button2.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0610 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0630 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0630 + * @tc.type : Inline input style, TextInput text is too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0630', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0630 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0630") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0630 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0710 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0710 + * @tc.type : Not entered state, TextInput text is not too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0710', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0710 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0710") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0710 finish.`); + done() + }) + + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0760 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0760 + * @tc.type : After clearing the overly long text, the placeholder text in the empty state is still too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0760', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0760 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0760") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + // cancelButton 是一个 Image 类型的组件 + let cancelButton: Component = await driver.waitForComponent(ON.type('Image'),1000); + // 点击 cancelButton 图标 + await cancelButton.click(); + await driver.waitForIdle(500,2000) + let Button1: Component = await driver.waitForComponent(ON.id('TextFadingEdgeTV0760_006'),1000); + await Button1.click(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0760 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0860 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0860 + * @tc.type : Input state, TextInput text is not too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0860', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0860 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0860") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0860 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0900 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0900 + * @tc.type : Entering a long text, after deleting the text, it is no longer too long. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0900', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0900 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0900") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + await driver.triggerKey(2055); + await driver.waitForIdle(500,2000) + // windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0900 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0910 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0910 + * @tc.type : Configure showUnderline to observe the fade-out marquee effect. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0910', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0910 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0910") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0910 finish.`); + done() + }) + + + /* + * @tc.number : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0920 + * @tc.name : SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0920 + * @tc.type : Set a maximum length limit; the text exceeds the allowed length. + * @tc.size : MediumTest + * @tc.level : 2 + */ + it('SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0920', Level.LEVEL2, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0920 start.`); + Settings.createWindow("testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0920") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500,2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_Text_FadingEdge_TV_0920 finish.`); + done() + }) + + + + }) +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0040.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7594d3ab7fe6bafa3c2997ab3440f1089e947d5 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0040.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0040 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 6, + loop: 2, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0070.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..da90180f651118966c22384e370f9125b0223ddf --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0070.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0070 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 6, + loop: -1, + delay: 500.5, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0130.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecb6733bc8ee439ad46dfe85be32b584c958744b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0130.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0130 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: false, + step: 6, + loop: -1, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0150.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..bafd20f2fe3cfaca4880bcb2ec1cfd499c2c1d22 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0150.ets @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0150 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: false, + step: 6, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0220.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d0414f6fb3a9c22bf748369bafc97bfb776b7e1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0220.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0220 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: false, + fromStart: false, + step: 6, + loop: -1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.ON_FOCUS + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0270.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0270.ets new file mode 100644 index 0000000000000000000000000000000000000000..08f72a55cc9ab6f4a36b7da199f0794baab6449a --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0270.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0270 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: false, + step: -5, + loop: 1, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + }.width('20%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0280.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0280.ets new file mode 100644 index 0000000000000000000000000000000000000000..f281b1b567478130878e540d3b9e9eaba2485437 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0280.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0280 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: false, + step: 10000, + loop: -1, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0290.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0290.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5491868489b24cf82d8f227d4ab0b3fc66f4256 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0290.ets @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0290 { + @State text:string = 'marquee' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text(this.text).fontSize(20).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: false, + step: 500, + loop: 1, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + this.text = 'MarqueeState.START' + } else if (state == MarqueeState.BOUNCE) { + this.text = 'MarqueeState.BOUNCE' + } else if (state == MarqueeState.FINISH) { + this.text = 'MarqueeState.FINISH' + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0360.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0360.ets new file mode 100644 index 0000000000000000000000000000000000000000..9706e6779dae9e624ff7b41e27b1d726701bacdb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0360.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0360 { + @State num:number = 0 + @State trans:boolean = false + @State new:number = 0 + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text(this.new.toString()).fontSize(20).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: this.trans, + step: 500, + loop: 5, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + this.new = 0 + } else if (state == MarqueeState.BOUNCE) { + this.num += 1 + if (this.num == 1){ + this.trans = true + } + else { + this.new += 1 + } + } else if (state == MarqueeState.FINISH) { + } + }) + } + } +} + + diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0370.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0370.ets new file mode 100644 index 0000000000000000000000000000000000000000..45ce2a8bf341216868bf21b9182f9c68a18231d8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0370.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0370 { + @State num:number = 0 + @State trans:boolean = false + @State new:number = 0 + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text(this.new.toString()).fontSize(20).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: this.trans, + step: 500, + loop: 3, + delay: 0, + fadeout: false, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + this.new = 0 + } else if (state == MarqueeState.BOUNCE) { + this.num += 1 + if (this.num == 1){ + this.trans = true + } + else { + this.new += 1 + } + } else if (state == MarqueeState.FINISH) { + } + }) + } + } +} + + diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0460.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0460.ets new file mode 100644 index 0000000000000000000000000000000000000000..b92659d20ac7c3d6bde6104b29dcc01dbacad612 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0460.ets @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0460 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0580.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0580.ets new file mode 100644 index 0000000000000000000000000000000000000000..6da83445eb0a7a97a1e52059344d5bb8dbab84dc --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0580.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0580 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text() + { + ImageSpan($r('app.media.icon')) + .width('200px') + .height('200px') + .objectFit(ImageFit.Fill) + .verticalAlign(ImageSpanAlignment.CENTER) + Span('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + } + .width(200) + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 300, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0590.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0590.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7700a43a0abf9dc2a46422d2dfa7f4a58283df0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0590.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0590 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text() + { + ImageSpan($r('app.media.icon')) + .width('200px') + .height('200px') + .objectFit(ImageFit.Fill) + .verticalAlign(ImageSpanAlignment.CENTER) + Span('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + } + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0600.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0600.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa08758c23695c055ddf527a37bf1246537f1bc7 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0600.ets @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0600 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + { + ImageSpan($r('app.media.icon')) + .width('200px') + .height('200px') + .objectFit(ImageFit.Fill) + .verticalAlign(ImageSpanAlignment.CENTER) + } + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0610.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0610.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6242d925a68ca453f54b7601a5f3af09602155e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0610.ets @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0610 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text() + { + ImageSpan($r('app.media.icon')) + .width('200px') + .height('200px') + .objectFit(ImageFit.Fill) + .verticalAlign(ImageSpanAlignment.CENTER) + Span('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + SymbolSpan($r('sys.symbol.ohos_trash')) + .fontWeight(FontWeight.Bold) + .fontSize(96) + } + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0640.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0640.ets new file mode 100644 index 0000000000000000000000000000000000000000..999a0120ef99b7ad2a39e4f9f7e47c4ebaed6026 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0640.ets @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0640 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0670.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0670.ets new file mode 100644 index 0000000000000000000000000000000000000000..56d353fb16a13df8492399211241635a98e9f17d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/ComponentTextTv/ComponentTextTv0670.ets @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ComponentTextTv0670 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text('marquee').fontSize(9).fontColor(0xCCCCCC) + // 设置文本超长时以跑马灯的方式展示 + Text('This is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee,his is the text with the text overflow set marquee') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + .textOverflow({ overflow: TextOverflow.MARQUEE }) + .marqueeOptions({ + start: true, + fromStart: true, + step: 500, + loop: 1, + delay: 0, + fadeout: true, + marqueeStartPolicy: MarqueeStartPolicy.DEFAULT + }) + .onMarqueeStateChange((state: MarqueeState) => { + if (state == MarqueeState.START) { + // "收到状态: START"; + } else if (state == MarqueeState.BOUNCE) { + // "收到状态: BOUNCE"; + } else if (state == MarqueeState.FINISH) { + // "收到状态: FINISH"; + } + }) + } + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0020.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..5918879d6e050f38e00e1b90e0666286eefb37b4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0020.ets @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0020 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .enabled(false) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0030.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d5af429db737969fa5f212c248461cbc11bc274 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0030.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0030 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0030_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0040.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..f042a42a66e8c77ff1bd8effd892f6f8127ecb31 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0040.ets @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0040 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State font:Font = {size:20,weight:600} + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .textFont(this.font) + Button('font change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0040_001') + .onClick(() => { + this.font = {size:24,weight:800} + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0040_002') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0050.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..080aaa99741e590bca5729bc35115ceb55d336a3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0050.ets @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0050 { + + controller: SearchController = new SearchController(); + @State trans:boolean = false + @State text:string = 'Search textAlign sample1,Search textAlign sample1,Search textAlign sample1' + + build() { + Column({ space: 3 }) { + Search({ value: this.text, controller: this.controller }) + .searchButton('SEARCH') + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + src: $r('sys.media.ohos_ic_public_cancel_filled') + } + }) + .width('95%') + .height(40) + .stopBackPress(true) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0050_001') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0060.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9c0057e8dd08eaa41c196056706fa635a23d80d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0060.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0060 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State text:string = 'Search textAlign sample1,Search textAlign sample1,Search textAlign sample1' + + build() { + Column({ space: 3 }) { + Search({ value: this.text, controller: this.controller }) + .searchButton('SEARCH') + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + src: $r('sys.media.ohos_ic_public_cancel_filled') + } + }) + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .onChange((value: string) => { + this.text = value; + }) + Button('input', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0060_001') + .onClick(() => { + this.text = 'another search text,another search text,another search text,another search text' + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0070.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e02abe9fdd2eecb45233da7bf8656b765e53520 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0070.ets @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0070 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State copyValue: string = ''; + @State cutValue: string = ''; + + build() { + Column({ space: 3 }) { + Text("copy: " + this.copyValue) + Text("cut:" + this.cutValue) + Search({ value: 'Search textAlign sample1,Search textAlign sample1,Search textAlign sample1', controller: this.controller }) + .searchButton('SEARCH') + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + src: $r('sys.media.ohos_ic_public_cancel_filled') + } + }) + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .copyOption(CopyOptions.LocalDevice) + .onCopy((value: string) => { + this.copyValue = value; + }) + .onCut((value: string) => { + this.cutValue = value; + }) + Button('Selection apart') + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0070_001') + .onClick(() => { + this.controller.setTextSelection(-1,50 , { menuPolicy: MenuPolicy.SHOW }); + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0210.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..419c216f5d39762786076050c237269e811528c4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0210.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0210 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(false) + .enableKeyboardOnFocus(false) + .enablePreviewText(false) + .enableHapticFeedback(false) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0210_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0260.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..353234f61cd6f222f1467fac60cc1ee38f62bd8f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0260.ets @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0260 { + + controller: SearchController = new SearchController(); + @State text:string = '' + @State changeValue: string = ''; + @State submitValue: string = ''; + + + build() { + Column({ space: 3 }) { + Search( + { value: this.text, + controller: this.controller , + placeholder:'请输入…这里是超长文本输入框测试文本'} + ) + .searchButton('SEARCH') + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + src: $r('sys.media.ohos_ic_public_cancel_filled') + } + }) + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(TextAlign.Start) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(false) + .enableKeyboardOnFocus(false) + .enablePreviewText(false) + .enableHapticFeedback(false) + .onSubmit((value: string) => { + this.submitValue = value; + }) + .onChange((value: string) => { + this.changeValue = value; + }) + .margin(20) + + Button('input', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0260_001') + .onClick(() => { + this.text = 'Search textAlign sample1,Search textAlign sample1,Search textAlign sample1' + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0390.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0390.ets new file mode 100644 index 0000000000000000000000000000000000000000..48431b1ef5f556b6b718cc1037888b55f2a37eb1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0390.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0390 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0390_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0420.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0420.ets new file mode 100644 index 0000000000000000000000000000000000000000..31316eb4e808db0efdbdae2a4ea68f09bdf3d8ba --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0420.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0420 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample1,Search textAlign sample1,Search textAlign sample1', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0420_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0430.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0430.ets new file mode 100644 index 0000000000000000000000000000000000000000..079dd051b32ff0f78d10ff8a080947a30b7ac0bd --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0430.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0430 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample1,Search textAlign', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0430_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0440.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0440.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e041f7d59dc13cc39725d88121f43d7db991a76 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0440.ets @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0440 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample1,Search textAlign', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .maxLength(30) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0440_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0480.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0480.ets new file mode 100644 index 0000000000000000000000000000000000000000..d72389be52e3c73221df5232f8c02a973b000dc7 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0480.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0480 { + + controller: SearchController = new SearchController(); + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + Search({ value: 'Search textAlign sample1,Search textAlign sample1,123456789123456789', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_001') + .onClick(() => { + this.controller.caretPosition(10) + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0480_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0520.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0520.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f203e653004b2c3f7e961e01106989968e527d9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0520.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0520 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .enabled(false) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0520_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0530.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0530.ets new file mode 100644 index 0000000000000000000000000000000000000000..e35944167e1e1e648f57d55f9bfc8bbd5763a949 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0530.ets @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0530 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State text:string = '' + @State textError:string = '' + @State focus:boolean = true + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller }) + .width('40%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .defaultFocus(this.focus) + .enableKeyboardOnFocus(this.focus) + .enablePreviewText(true) + .enableHapticFeedback(true) + .showError(this.textError) + .showUnderline(true) + .onChange((value: string) => { + this.text = value + if(this.text=='123'){ + this.textError = ''; + } + else { + this.textError = 'Error文本这里是超长Eror文本输入框测试文本'; + this.text = ''; + } + }) + Row(){ + Button('input', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0530_001') + .onClick(() => { + this.text = 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample' + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0530_002') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + Row(){ + Button('focus', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0530_003') + .onClick(() => { + this.focus = true + }) + Button('not focus', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0530_004') + .onClick(() => { + this.focus = false + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0530_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0560.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0560.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d0b37e7184c11a944026ac3da9170e4c26ce283 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0560.ets @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0560 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '50%' + @State typ:InputType = InputType.Normal + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .type(this.typ) + Row(){ + Button('type change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_001') + .onClick(() => { + this.typ = InputType.Password + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0560_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0570.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0570.ets new file mode 100644 index 0000000000000000000000000000000000000000..33b0a7714bb5ab511265fa4cf0fd3636f44f9b7b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0570.ets @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0570 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width('95%') + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('Align change1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_001') + .onClick(() => { + this.Alignment = TextAlign.Center + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0570_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0610.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0610.ets new file mode 100644 index 0000000000000000000000000000000000000000..cdd6bdaf89ce0838895d8e735940fd8abc20029b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0610.ets @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0610 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '50%' + @State pad:number = 0 + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .padding(this.pad) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_001') + .onClick(() => { + this.wid = '95%' + }) + Button('padding change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_002') + .onClick(() => { + this.pad = 15 + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0610_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0620.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0620.ets new file mode 100644 index 0000000000000000000000000000000000000000..67a39b5234ce944273ac3b0ffcfb90f926cd3359 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0620.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0620 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '50%' + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0620_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0630.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0630.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6f8b67c4701d6fa6a9738574e5b39d67223df27 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0630.ets @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0630 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample,Search textAlign sample,Search textAlign sample,Search textAlign sample', controller: this.controller }) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .style(TextInputStyle.Inline) + .maxLines(1) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0630_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0710.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0710.ets new file mode 100644 index 0000000000000000000000000000000000000000..37322812dc91a331912421319ab334f47b811fdc --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0710.ets @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0710 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + + build() { + Column({ space: 3 }) { + TextInput({ text: 'Search textAlign sample', controller: this.controller }) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(false) + .enableKeyboardOnFocus(false) + .enablePreviewText(false) + .enableHapticFeedback(false) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0710_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0760.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0760.ets new file mode 100644 index 0000000000000000000000000000000000000000..381db9d354ce00a33783d7d36b8260a076f67431 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0760.ets @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0760 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '50%' + @State text:string = 'Search textAlign sample,Search textAlign sample,Search textAlign sample' + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller ,placeholder:'请输入文本这里是超长文本输入框测试文本'}) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + size: 35, + src: $r('app.media.app_icon'), + color: Color.Blue + } + }) + .onChange((value: string) => { + this.text = value; + }) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0760_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0860.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0860.ets new file mode 100644 index 0000000000000000000000000000000000000000..a850b9f336e3f2c97d0896d9e3225f23cbfe9cf7 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0860.ets @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0860 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + @State text:string = 'Search textAlign sample' + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller ,placeholder:'请输入文本这里是文本输入框测试文本'}) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + size: 35, + src: $r('app.media.app_icon'), + color: Color.Blue + } + }) + .onChange((value: string) => { + this.text = value; + }) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0860_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0900.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0900.ets new file mode 100644 index 0000000000000000000000000000000000000000..368b8924921cce281b2f3676a4429e3bfc394348 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0900.ets @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextFadingEdgeTV0900 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + @State text:string = 'Search textAlign sample,Search textAlign sample,' + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller ,placeholder:'请输入文本这里是文本输入框测试文本'}) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + size: 35, + src: $r('app.media.app_icon'), + color: Color.Blue + } + }) + .onChange((value: string) => { + this.text = value; + }) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0900_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0910.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0910.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c023f9a4cc7d36e7ef7980f514be76fcfd2a80b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0910.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. + */ + +@Entry +@Component +struct TextFadingEdgeTV0910 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + @State text:string = 'Search textAlign sample,Search textAlign sample,' + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller ,placeholder:'请输入文本这里是文本输入框测试文本'}) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .showUnderline(true) + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + size: 35, + src: $r('app.media.app_icon'), + color: Color.Blue + } + }) + .onChange((value: string) => { + this.text = value; + }) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0910_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0920.ets b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0920.ets new file mode 100644 index 0000000000000000000000000000000000000000..f510812b4f9f6e438bb7a8c0fb4b8d4b7c42a7ae --- /dev/null +++ b/sample/ui_compare/uiCompareTest_07/entry/src/ohosTest/ets/testability/pages/TextFadingEdgeTV/TextFadingEdgeTV0920.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. + */ + +@Entry +@Component +struct TextFadingEdgeTV0920 { + + controller: TextInputController = new TextInputController() + @State Alignment:TextAlign = TextAlign.Start + @State trans:boolean = false + @State wid:string = '90%' + @State text:string = 'Search textAlign sample,Search textAlign sample,' + + build() { + Column({ space: 3 }) { + TextInput({ text: this.text, controller: this.controller ,placeholder:'请输入文本这里是文本输入框测试文本'}) + .width(this.wid) + .height(40) + .stopBackPress(true) + .textAlign(this.Alignment) + .caretStyle({ width: 3, color: Color.Green }) + .selectedBackgroundColor(Color.Gray) + .defaultFocus(true) + .enableKeyboardOnFocus(true) + .enablePreviewText(true) + .enableHapticFeedback(true) + .maxLength(20) + .cancelButton({ + style: CancelButtonStyle.CONSTANT, + icon: { + size: 35, + src: $r('app.media.app_icon'), + color: Color.Blue + } + }) + .onChange((value: string) => { + this.text = value; + }) + Row(){ + Button('width change', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_001') + .onClick(() => { + this.wid = '95%' + }) + Button('Align change2', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_002') + .onClick(() => { + this.Alignment = TextAlign.End + }) + } + Row(){ + Button('√', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_003') + .onClick(() => { + this.trans = true + }) + Button('Set caretPosition -1', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_004') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(-1); + }) + } + Row(){ + Button('Set caretPosition', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_005') + .onClick(() => { + // 设置光标位置到输入的最后一个字符后 + this.controller.caretPosition(100); + }) + Button('x', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(200) + .margin(20) + .id('TextFadingEdgeTV0920_006') + .onClick(() => { + // 关闭自定义键盘 + this.controller.stopEditing(); + }) + } + } + .width('100%') + .height('100%') + } +}