diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/test/SnapshotGetsyncTest/SnapshotGetsync.test.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/test/SnapshotGetsyncTest/SnapshotGetsync.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bbf22d8a831ac83418c1bd88ccd25cb544abbd8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/test/SnapshotGetsyncTest/SnapshotGetsync.test.ets @@ -0,0 +1,1058 @@ +/** + * 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 SnapshotGetsync() { + + describe('SnapshotGetsync', () => { + 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_SNAPSHOT_GETSYNC_0080 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0080 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0080', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0080 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync80") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0080 finish.`); + done(); + }) + + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0210 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0210 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0210', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0210 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync210") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0210 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0100 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0100 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0100', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0100 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync100") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0100 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0110 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0110 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0110', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0110 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync110") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0110 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0120 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0120 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0120', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0120 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync120") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0120 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0190 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0190 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0190', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0190 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync190") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0190 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0250 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0250 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0250', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0250 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync250") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0250 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0180 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0180 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0180', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0180 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync180") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0180 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0200 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0200 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0200', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0200 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync200") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0200 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0170 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0170 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0170', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0170 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync170") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0170 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0220 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0220 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0220', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0220 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync220") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0220 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0260 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0260 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0260', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0260 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync260") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0260 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0060 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0060 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0060', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0060 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync60") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0060 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0270 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0270 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0270', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0270 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync270") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0270 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0240 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0240 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0240', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0240 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync240") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0240 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0280 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0280 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0280', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0280 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync280") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0280 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0320 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0320 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0320', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0320 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync320") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0320 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0300 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0300 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0300', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0300 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync300") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0300 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0350 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0350 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0350', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0350 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync350") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0350 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0290 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0290 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0290', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0290 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync290") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0290 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0310 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0310 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0310', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0310 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync310") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0310 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0340 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0340 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0340', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0340 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync340") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0340 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0390 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0390 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0390', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0390 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync390") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0390 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0360 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0360 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0360', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0360 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync360") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0360 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0420 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0420 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0420', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0420 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync420") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0420 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0370 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0370 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0370', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0370 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync370") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0370 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0410 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0410 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0410', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0410 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync410") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0410 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0380 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0380 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0380', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0380 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync380") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0380 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0430 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0430 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0430', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0430 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync430") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0430 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0440 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0440 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0440', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0440 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync440") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0440 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0550 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0550 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0550', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0550 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync550") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0550 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0450 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0450 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0450', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0450 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync450") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0450 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0330 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0330 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0330', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0330 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync330") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0330 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0560 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0560 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0560', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0560 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync560") + let driver:Driver = Driver.create(); + // 通过ID定位(推荐) + let component = await driver.waitForComponent(ON.id('button'), 1000); // 显式等待组件出现[6](@ref) + await component.click(); + await driver.waitForIdle(500,2000); + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0560 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0460 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0460 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0460', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0460 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync460") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0460 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0090 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0090 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0090', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0090 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync90") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0090 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0490 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0490 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0490', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0490 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync490") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0490 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0050 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0050 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0050', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0050 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync50") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0050 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0470 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0470 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0470', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0470 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync470") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0470 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0010 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0010 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0010', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0010 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync10") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0010 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0480 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0480 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0480', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0480 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync480") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0480 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0160 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0160 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0160', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0160 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync160") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0160 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0500 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0500 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0500', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0500 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync500") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0500 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0070 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0070 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0070', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0070 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync70") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0070 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0030 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0030 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0030', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0030 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync30") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0030 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0140 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0140 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0140', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0140 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync140") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0140 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0020 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0020 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0020', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0020 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync20") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0020 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0150 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0150 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0150', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0150 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync150") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0150 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0130 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0130 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0130', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0130 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync130") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0130 finish.`); + done(); + }) + + /* + * @tc.number : SUB_ACE_UI_SNAPSHOT_GETSYNC_0040 + * @tc.name : SUB_ACE_UI_SNAPSHOT_GETSYNC_0040 + * @tc.desc : Use get(id,callback) to get a screenshot of the List component, and the component is out of the screen + * @tc.type : Function + * @tc.size : MediumTest + * @tc.level : 3 + */ + it('SUB_ACE_UI_SNAPSHOT_GETSYNC_0040', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0040 start.`); + Settings.createWindow("testability/pages/SnapshotGetsync/SnapshotGetsync40") + windowSnap.snapShot(); + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_SNAPSHOT_GETSYNC_0040 finish.`); + done(); + }) + }) +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync10.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync10.ets new file mode 100644 index 0000000000000000000000000000000000000000..033ff3565678b89c129c00049dadfcb000a1fb7e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync10.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync10 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync100.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync100.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e6e5cd96e697bc1579004eee3bbe84556274640 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync100.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync100 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 4, waitUntilRenderFinished : undefined}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync110.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync110.ets new file mode 100644 index 0000000000000000000000000000000000000000..41be3a883e4af779611d30ec4b120469a5fcd02c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync110.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync110 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 13, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync120.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync120.ets new file mode 100644 index 0000000000000000000000000000000000000000..609bf2c29561af8daf319f4ae5dd0fb02f6e9788 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync120.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync120 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 0.01, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync130.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync130.ets new file mode 100644 index 0000000000000000000000000000000000000000..32f4bd76a7b592585449f65f916805412f7a9120 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync130.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync130 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 13.2, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync140.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync140.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7eeb591fdc1c9fddfd8697861fa2ae3238bf7e6 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync140.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync140 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 13.3, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync150.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync150.ets new file mode 100644 index 0000000000000000000000000000000000000000..cba5fe6b3f7494e668c9a367d51d4bb00438ecb9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync150.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync150 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 4}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync160.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync160.ets new file mode 100644 index 0000000000000000000000000000000000000000..fcd12898b9afb56cd1b3ac0ea3097a780ff81193 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync160.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync160 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('1', { waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync170.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync170.ets new file mode 100644 index 0000000000000000000000000000000000000000..8aa0ce0a740456ae99f36ba2059c1b29062aa00a --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync170.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync170 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('1', {scale : 1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync180.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync180.ets new file mode 100644 index 0000000000000000000000000000000000000000..e86f6b277a709aadf4d7c279a0a125846c1d80fd --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync180.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync180 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('ab', {scale : 0.5, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync190.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync190.ets new file mode 100644 index 0000000000000000000000000000000000000000..21b2259b26221006c67c1e36ce77733989374901 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync190.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync190 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('-1', {scale : 4, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync20.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync20.ets new file mode 100644 index 0000000000000000000000000000000000000000..8daf990af4a820422a9eb205cf95840830fdb344 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync20.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync20 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 0.5, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync200.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync200.ets new file mode 100644 index 0000000000000000000000000000000000000000..9403a3556cb184ee67fe0eab4bff87c55571769b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync200.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync200 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("",{scale : -1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync210.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync210.ets new file mode 100644 index 0000000000000000000000000000000000000000..687bd4cdb913e9b69f786278c40f7edebfe2be5b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync210.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync210 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('-2', {scale : 4, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync220.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync220.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c478c543b677f8fd630f1722d41f1ec33205341 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync220.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync220 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root') + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync240.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync240.ets new file mode 100644 index 0000000000000000000000000000000000000000..721a8b66676cfd327c00b852ada7c00ab63f6bbb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync240.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync240 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 13, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync250.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync250.ets new file mode 100644 index 0000000000000000000000000000000000000000..d641a63bbbe90567fb07fea20e7426e551218546 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync250.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync250 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 13, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync260.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync260.ets new file mode 100644 index 0000000000000000000000000000000000000000..be4d5727c1335d1805f85453343cd6ec23335c01 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync260.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync260 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync270.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync270.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d8cd933170a063300bfe33ca2524e05f2ea56a9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync270.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync270 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 0.5, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync280.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync280.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb8d62b43a3c690ec9c84f9665769105e97fe5af --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync280.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync280 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 4, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync290.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync290.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2eedb5c9cd1fd47e4cc455b008da0a1aa5c2837 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync290.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync290 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : -1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync30.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync30.ets new file mode 100644 index 0000000000000000000000000000000000000000..176a50b5ab9f41ed8ee6d3718aa2cca546943bcb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync30.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync30 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 4, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync300.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync300.ets new file mode 100644 index 0000000000000000000000000000000000000000..33551c50ef6a97c8d46c0d69912422f2f93f43e0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync300.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync320 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 0, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync310.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync310.ets new file mode 100644 index 0000000000000000000000000000000000000000..69620f3dccfbdeba7e60671b8bce8436daffd6f8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync310.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync310 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : undefined, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync320.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync320.ets new file mode 100644 index 0000000000000000000000000000000000000000..f088687ee5d4ba32d3c86c3750b2c1bafd2958a9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync320.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync320 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 0, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync330.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync330.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea83b5322d496627624809565e477adbc69da724 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync330.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync330 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 1, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync340.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync340.ets new file mode 100644 index 0000000000000000000000000000000000000000..744ecd52dd37d251da4ce6f4de28d97fb7c28383 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync340.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync340 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : -1, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync350.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync350.ets new file mode 100644 index 0000000000000000000000000000000000000000..11cc22c3968894da9ea8ca6dfa2302cf4f32c8bc --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync350.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync350 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {scale : 4}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync360.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync360.ets new file mode 100644 index 0000000000000000000000000000000000000000..924e3d2d286f9067178be5685661ae22ced49013 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync360.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync360 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root', {waitUntilRenderFinished:true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync370.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync370.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b3b9b150312b6a1adffe449637094fa5fe11777 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync370.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync370 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('1', {scale : 1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync380.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync380.ets new file mode 100644 index 0000000000000000000000000000000000000000..762ef377fc6bc1fee07003ff9ab71b9c4416227d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync380.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync380 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('ab', {scale : 0.5, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync390.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync390.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b06907b25969fe2672115c15c48a6a189a96e74 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync390.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync390 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('-0.1', {scale : 4, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync40.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync40.ets new file mode 100644 index 0000000000000000000000000000000000000000..e730ce3670b78671eb455099207480543b190f3d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync40.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync40 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : -1, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync410.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync410.ets new file mode 100644 index 0000000000000000000000000000000000000000..51ab77285ed1edd388d863885e2bb952f542e8c9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync410.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync410 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('-2', {scale : 4, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync420.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync420.ets new file mode 100644 index 0000000000000000000000000000000000000000..09d6b78f44b4fad63666403b85a2341b523a3775 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync420.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync420 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root') + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync430.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync430.ets new file mode 100644 index 0000000000000000000000000000000000000000..c94ebfc29e83942ee41cb967c4ad0c6c8c4a1fca --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync430.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync430 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(50).height(50).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:50.4}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync440.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync440.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8e572fccdf07aa50d709b6578b212781de3a719 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync440.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync440 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(50).height(50).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:51}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync450.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync450.ets new file mode 100644 index 0000000000000000000000000000000000000000..3470a67d8aaeb0ccb85653ae3411d1aaa94472a4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync450.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync450 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(2520).height(2520).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:1}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync460.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync460.ets new file mode 100644 index 0000000000000000000000000000000000000000..a209b4d9a0eabe7ee140fbc08a5684f2f6d21e8a --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync460.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync460 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(2520).height(2520).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:14}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync470.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync470.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac8998761e18a22560fdbc045c7873363f137d9d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync470.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync470 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(50).height(50).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(50).height(50).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:50.4}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync480.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync480.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0d03ecd63e9103f9ff34b828b1b91ec0ecb70bd --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync480.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync480 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(50).height(50).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(50).height(50).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:51}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync490.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync490.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d7e48598639541b5ce9e8d39b926cbe6ad79973 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync490.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync490 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(220).height(220).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:0.5,waitUntilRenderFinished:true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync50.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync50.ets new file mode 100644 index 0000000000000000000000000000000000000000..e617e8b8209b996a0bacd938c9571a2ae96b9a44 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync50.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync50 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 0, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync500.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync500.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1e1b5dbc6f08feacc31de6a905e431105c7b3d1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync500.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync500 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(220).height(220).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:4,waitUntilRenderFinished:true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync550.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync550.ets new file mode 100644 index 0000000000000000000000000000000000000000..29ad531aca7face57cef2dc4c4c1682b86238186 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync550.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync550 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(50).height(50).margin(5).id("root").visibility(Visibility.None) + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:1,waitUntilRenderFinished:true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync560.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync560.ets new file mode 100644 index 0000000000000000000000000000000000000000..52de055b9c4e2edfeeb236f3de796360f037ee35 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync560.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. + */ +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync560 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.icon')).width(50).height(50).margin(5).id("root").visibility(Visibility.Hidden) + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync('root',{scale:1,waitUntilRenderFinished:true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync60.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync60.ets new file mode 100644 index 0000000000000000000000000000000000000000..501a29c449e35c190262aa18dc850580f9ee1099 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync60.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync60 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : undefined, waitUntilRenderFinished : true}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync70.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync70.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc6603069edc4801e6506732b15c406f53b5fb22 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync70.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync70 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 0, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync80.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync80.ets new file mode 100644 index 0000000000000000000000000000000000000000..03f3a22402d2988ce9ae85d2174c7371eca02e21 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync80.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync80 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : 1, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} diff --git a/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync90.ets b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync90.ets new file mode 100644 index 0000000000000000000000000000000000000000..81e8a875cdf8a2cf990577641dea1e89af2776a8 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_09/entry/src/ohosTest/ets/testability/pages/SnapshotGetsync/SnapshotGetsync90.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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct SnapshotGetsync90 { + @State pixmap: image.PixelMap | undefined = undefined + + build() { + Column() { + Row() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Text('app.media.img').width(200).height(200).margin(5).id("root") + } + Button("click to generate UI snapshot") + .onClick(() => { + try { + // 建议使用this.getUIContext().getComponentSnapshot().getSync() + let pixelmap = componentSnapshot.getSync("root", {scale : -1, waitUntilRenderFinished : false}) + this.pixmap = pixelmap + } catch (error) { + console.error("getSync errorCode: " + error.code + " message: " + error.message) + } + }).margin(10) + .id('button') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +}